From 3348cb67d654e72958699d80d799b6439e8cc056 Mon Sep 17 00:00:00 2001 From: Jakub Hurej Date: Tue, 23 Jan 2024 14:22:45 +0100 Subject: [PATCH] Add 400 error status to exception handling in mfa/FIDO2.complete_reg --- mfa/FIDO2.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mfa/FIDO2.py b/mfa/FIDO2.py index bd78ef0..6cd762b 100644 --- a/mfa/FIDO2.py +++ b/mfa/FIDO2.py @@ -47,10 +47,13 @@ def begin_registeration(request): @csrf_exempt def complete_reg(request): - """Completes the registeration, called by API""" + """Completes the registration, called by API""" try: if not "fido_state" in request.session: - return JsonResponse({'status': 'ERR', "message": "FIDO Status can't be found, please try again"}) + return JsonResponse( + {'status': 'ERR', "message": "FIDO Status can't be found, please try again"}, + status=400 + ) data = cbor.decode(request.body) client_data = CollectedClientData(data['clientDataJSON']) @@ -81,7 +84,7 @@ def complete_reg(request): client.captureException() except: pass - return JsonResponse({'status': 'ERR', "message": "Error on server, please try again later"}) + return JsonResponse({'status': 'ERR', "message": "Error on server, please try again later"}, status=400) def start(request):