Updated the user auth and user auth key email endpoints and functions.
This commit is contained in:
@@ -605,12 +605,13 @@ def get_user_rec_list(
|
||||
|
||||
|
||||
# ### BEGIN ### User Methods ### email_user_auth_key_url() ###
|
||||
# This emails the actual one time use sign in URL for a user.
|
||||
# Updated 2021-12-02
|
||||
# This generates a new auth_key token and emails the actual one time use sign in URL to the user's email.
|
||||
# Updated 2025-04-08
|
||||
def email_user_auth_key_url(
|
||||
account_id: int|str,
|
||||
user_id: int|str,
|
||||
root_url: str,
|
||||
key_param_name: str = 'auth_key',
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -684,8 +685,13 @@ def email_user_auth_key_url(
|
||||
else: enable_to_str = '-- Not Set --'
|
||||
auth_key = user_obj.auth_key
|
||||
|
||||
user_login_url = f'{root_url}user/login?username={urllib.parse.quote(username)}&email={urllib.parse.quote(to_email)}'
|
||||
user_login_auth_key_url = f'{root_url}?user_id={urllib.parse.quote(user_id_random)}&auth_key={urllib.parse.quote(new_auth_key)}&valid_email={True}'
|
||||
user_login_url = f'{root_url}?username={urllib.parse.quote(username)}&user_email={urllib.parse.quote(to_email)}'
|
||||
# user_login_url = f'{root_url}user/login?username={urllib.parse.quote(username)}&email={urllib.parse.quote(to_email)}'
|
||||
|
||||
if key_param_name == 'auth_key':
|
||||
user_login_auth_key_url = f'{root_url}?user_id={urllib.parse.quote(user_id_random)}&auth_key={urllib.parse.quote(new_auth_key)}&valid_email={True}'
|
||||
elif key_param_name:
|
||||
user_login_auth_key_url = f'{root_url}?user_id={urllib.parse.quote(user_id_random)}&{key_param_name}={urllib.parse.quote(new_auth_key)}&valid_email={True}'
|
||||
|
||||
subject = f'{account_short_name}: One Time Use Sign In Link ({new_auth_key})'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user