fairdm.contrib.contributors.adapters#

allauth adapters that gate signup and link ORCID sign-in to contributor profiles.

Module Contents#

Classes#

AccountAdapter

Account adapter that opens signup by switch, invitation and verified email.

SocialAccountAdapter

Social account adapter that claims or links a profile on ORCID sign-in.

Functions#

is_provider

Check whether a social login came from the named provider.

API#

is_provider(name, sociallogin)#

Check whether a social login came from the named provider.

Args: name: The provider name, such as "orcid". sociallogin: The social login being processed.

Returns: True when the login’s provider is name.

class AccountAdapter(request: django.http.HttpRequest | None = None)#

Bases: allauth.account.adapter.DefaultAccountAdapter

Account adapter that opens signup by switch, invitation and verified email.

Initialization

is_open_for_signup(request: django.http.HttpRequest)#

Allow signup when the allow_signup switch is on and either the email is verified or signup is not invitation-only.

get_user_signed_up_signal()#

Return allauth’s user_signed_up signal.

class SocialAccountAdapter(request: django.http.HttpRequest | None = None)#

Bases: allauth.socialaccount.adapter.DefaultSocialAccountAdapter

Social account adapter that claims or links a profile on ORCID sign-in.

Initialization

is_open_for_signup(request, socialogin)#

Also require the allow_signup switch to be on.

get_signup_form_initial_data(sociallogin)#

Prefill the signup form’s name from the social login.

get_db_user_by_orcid(orcid_id)#

Find the profile that holds an ORCID iD.

Args: orcid_id: The ORCID iD.

Returns: The profile, or None when no identifier row matches.

pre_social_login(request, sociallogin)#

Claim an unclaimed profile that already holds the signing-in ORCID iD.

save_user(request, sociallogin, form=None)#

Adopt an unclaimed profile holding the ORCID iD, or create a new user and attach the iD.

populate_user(request, sociallogin, data)#

Fill the user from the ORCID record’s extra data.