fix(chalice): fixed reset&update password at the same time (#1786)

This commit is contained in:
Kraiem Taha Yassine 2023-12-19 17:17:30 +01:00 committed by GitHub
parent aeea4e50aa
commit 77281ebd3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -125,6 +125,8 @@ def update(tenant_id, user_id, changes, output=True):
if key == "password":
sub_query_bauth.append("password = crypt(%(password)s, gen_salt('bf', 12))")
sub_query_bauth.append("changed_at = timezone('utc'::text, now())")
sub_query_bauth.append("change_pwd_expire_at = NULL")
sub_query_bauth.append("change_pwd_token = NULL")
else:
sub_query_bauth.append(f"{helper.key_to_snake_case(key)} = %({key})s")
else:

View file

@ -150,6 +150,8 @@ def update(tenant_id, user_id, changes, output=True):
if key == "password":
sub_query_bauth.append("password = crypt(%(password)s, gen_salt('bf', 12))")
sub_query_bauth.append("changed_at = timezone('utc'::text, now())")
sub_query_bauth.append("change_pwd_expire_at = NULL")
sub_query_bauth.append("change_pwd_token = NULL")
else:
sub_query_bauth.append(f"{helper.key_to_snake_case(key)} = %({key})s")
else: