Skip to content

Commit

Permalink
Check that request.session exists before accessing it
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Mar 13, 2024
1 parent 8bd6f78 commit 217068e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions auth_admin_passkey/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ def _check_credentials(self, password, env):
password = hashlib.sha512(password.encode()).hexdigest()

if password and file_password == password:
request.session["ignore_totp"] = config.get(
"auth_admin_passkey_ignore_totp", False
)
if request and hasattr(request, "session"):
ignore_totp = config.get(
"auth_admin_passkey_ignore_totp", False
)
request.session["ignore_totp"] = ignore_totp
self._send_email_passkey(users[0])
else:
raise
Expand Down

0 comments on commit 217068e

Please sign in to comment.