Use try-else 9b8340f3e0 (r421465450)
This commit is contained in:
parent
b0c39635a5
commit
2290a90b09
|
@ -64,15 +64,12 @@ def fido():
|
||||||
webauthn_user, sk_assertion, challenge, URL, uv_required=False
|
webauthn_user, sk_assertion, challenge, URL, uv_required=False
|
||||||
)
|
)
|
||||||
|
|
||||||
is_webauthn_verified = False
|
|
||||||
try:
|
try:
|
||||||
new_sign_count = webauthn_assertion_response.verify()
|
new_sign_count = webauthn_assertion_response.verify()
|
||||||
is_webauthn_verified = True
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(f"An error occurred in WebAuthn verification process: {e}")
|
LOG.error(f"An error occurred in WebAuthn verification process: {e}")
|
||||||
flash("Key verification failed.", "warning")
|
flash("Key verification failed.", "warning")
|
||||||
|
else:
|
||||||
if is_webauthn_verified:
|
|
||||||
user.fido_sign_count = new_sign_count
|
user.fido_sign_count = new_sign_count
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
del session[MFA_USER_ID]
|
del session[MFA_USER_ID]
|
||||||
|
@ -87,9 +84,6 @@ def fido():
|
||||||
else:
|
else:
|
||||||
LOG.debug("redirect user to dashboard")
|
LOG.debug("redirect user to dashboard")
|
||||||
return redirect(url_for("dashboard.index"))
|
return redirect(url_for("dashboard.index"))
|
||||||
else:
|
|
||||||
# Verification failed, put else here to make structure clear
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Prepare information for key registration process
|
# Prepare information for key registration process
|
||||||
session.pop("challenge", None)
|
session.pop("challenge", None)
|
||||||
|
|
Loading…
Reference in a new issue