From c9808edde2d69a6b329a82fdfda06ff07017a23b Mon Sep 17 00:00:00 2001 From: Nguyen Ngo Date: Mon, 18 May 2026 18:29:57 -0400 Subject: [PATCH] 05/18 Enhanced codes and functionalities 6 --- app/routes/webauthn.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/routes/webauthn.py b/app/routes/webauthn.py index 635c60e..699985a 100644 --- a/app/routes/webauthn.py +++ b/app/routes/webauthn.py @@ -36,7 +36,11 @@ from webauthn.helpers.structs import ( UserVerificationRequirement, AuthenticatorAttachment, ) -from webauthn.helpers.exceptions import InvalidCBORData, InvalidAuthenticatorResponse +from webauthn.helpers.exceptions import ( + InvalidCBORData, + InvalidRegistrationResponse, + InvalidAuthenticationResponse, +) from flask import Blueprint, request, jsonify, g, session, current_app from app import db, limiter, client_ip @@ -142,7 +146,7 @@ def register_complete(): expected_origin=_origins(), require_user_verification=False, ) - except (InvalidCBORData, InvalidAuthenticatorResponse, Exception) as e: + except (InvalidCBORData, InvalidRegistrationResponse, Exception) as e: return jsonify({'error': f'Registration verification failed: {str(e)}'}), 400 # Persist the new credential. @@ -385,4 +389,4 @@ def delete_credential(cred_id): ip_address=client_ip(), ) db.session.commit() - return jsonify({'message': 'Passkey removed'}), 200 + return jsonify({'message': 'Passkey removed'}), 200 \ No newline at end of file