From 2290a90b09468bebbf2e043bfbc6bbfef7fad446 Mon Sep 17 00:00:00 2001 From: devStorm <59678453+developStorm@users.noreply.github.com> Date: Thu, 7 May 2020 05:41:34 -0700 Subject: [PATCH] Use try-else https://github.com/simple-login/app/pull/159/files/9b8340f3e0d49b68cf765b6c982d824c3f89a129#r421465450 --- app/auth/views/fido.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/auth/views/fido.py b/app/auth/views/fido.py index adbb2838..2d00bad4 100644 --- a/app/auth/views/fido.py +++ b/app/auth/views/fido.py @@ -64,15 +64,12 @@ def fido(): webauthn_user, sk_assertion, challenge, URL, uv_required=False ) - is_webauthn_verified = False try: new_sign_count = webauthn_assertion_response.verify() - is_webauthn_verified = True except Exception as e: LOG.error(f"An error occurred in WebAuthn verification process: {e}") flash("Key verification failed.", "warning") - - if is_webauthn_verified: + else: user.fido_sign_count = new_sign_count db.session.commit() del session[MFA_USER_ID] @@ -87,10 +84,7 @@ def fido(): else: LOG.debug("redirect user to dashboard") return redirect(url_for("dashboard.index")) - else: - # Verification failed, put else here to make structure clear - pass - + # Prepare information for key registration process session.pop("challenge", None) challenge = secrets.token_urlsafe(32)