Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 400 error status to exception handling in mfa/FIDO2.complete_reg #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions mfa/FIDO2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down Expand Up @@ -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):
Expand Down