diff --git a/api/chalicelib/core/users.py b/api/chalicelib/core/users.py index 3e5758004..c2503db6d 100644 --- a/api/chalicelib/core/users.py +++ b/api/chalicelib/core/users.py @@ -431,14 +431,14 @@ def delete_member(user_id, tenant_id, id_to_delete): with pg_client.PostgresClient() as cur: cur.execute( cur.mogrify(f"""UPDATE public.users - SET deleted_at = timezone('utc'::text, now()) + SET deleted_at = timezone('utc'::text, now()), + jwt_iat= NULL, jwt_refresh_jti= NULL, + jwt_refresh_iat= NULL WHERE user_id=%(user_id)s;""", {"user_id": id_to_delete})) cur.execute( cur.mogrify(f"""UPDATE public.basic_authentication - SET password= NULL, jwt_iat= NULL, - jwt_refresh_jti= NULL, jwt_refresh_iat= NULL, - password= NULL, invitation_token= NULL, + SET password= NULL, invitation_token= NULL, invited_at= NULL, changed_at= NULL, change_pwd_expire_at= NULL, change_pwd_token= NULL WHERE user_id=%(user_id)s;""", diff --git a/ee/api/chalicelib/core/users.py b/ee/api/chalicelib/core/users.py index 79aabaafe..1e998740e 100644 --- a/ee/api/chalicelib/core/users.py +++ b/ee/api/chalicelib/core/users.py @@ -490,14 +490,14 @@ def delete_member(user_id, tenant_id, id_to_delete): with pg_client.PostgresClient() as cur: cur.execute( cur.mogrify(f"""UPDATE public.users - SET deleted_at = timezone('utc'::text, now()), role_id=NULL + SET deleted_at = timezone('utc'::text, now()), role_id=NULL, + jwt_iat= NULL, jwt_refresh_jti= NULL, + jwt_refresh_iat= NULL WHERE user_id=%(user_id)s AND tenant_id=%(tenant_id)s;""", {"user_id": id_to_delete, "tenant_id": tenant_id})) cur.execute( cur.mogrify(f"""UPDATE public.basic_authentication - SET password=NULL, jwt_iat= NULL, - jwt_refresh_jti= NULL, jwt_refresh_iat= NULL, - password= NULL, invitation_token= NULL, + SET password=NULL, invitation_token= NULL, invited_at= NULL, changed_at= NULL, change_pwd_expire_at= NULL, change_pwd_token= NULL WHERE user_id=%(user_id)s;""",