Utils
hypha.apply.users.utils
¶
get_user_by_email
¶
Source code in hypha/apply/users/utils.py
is_user_already_registered
¶
Checks if a specified user is already registered. Returns a tuple containing a boolean value that indicates if the user exists and in case he does whats the duplicated attribute
Source code in hypha/apply/users/utils.py
can_use_oauth_check
¶
Checks that the user belongs to the whitelisted domains. Anonymous or non-whitelisted email domains cannot log in or associate OAuth accounts
Source code in hypha/apply/users/utils.py
send_activation_email
¶
send_activation_email(user, site=None, email_template='users/activation/email.txt', email_subject_template='users/activation/email_subject.txt', redirect_url='')
Send the activation email. The activation key is the username, signed using TimestampSigner.
Source code in hypha/apply/users/utils.py
send_confirmation_email
¶
Send the confirmation email. The confirmation token is the update email, signed using TimestampSigner.
Source code in hypha/apply/users/utils.py
get_redirect_url
¶
Return the user-originating redirect URL if it's safe.
Parameters:
-
request
(HttpRequest
) –The request object.
-
redirect_field
(str
) –The name of a field containing the redirect URL.
-
success_url_allowed_hosts
(set
, default:None
) –A set of allowed hosts for the redirect URL.
Source code in hypha/apply/users/utils.py
generate_numeric_token
¶
Generate a random 6 digit string of numbers. We use this formatting to allow leading 0s.
update_is_staff
¶
Determine if the user should have is_staff
Django Admin is the only use for is_staff
Parameters:
-
request
–The edit request object (unused)
-
user
–User
to modify