Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalioby committed Oct 10, 2022
1 parent 0936ea2 commit 54db5a5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mfa/FIDO2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import datetime
from .Common import get_redirect_url
from django.utils import timezone

from django.http import JsonResponse

def recheck(request):
"""Starts FIDO2 recheck"""
Expand Down Expand Up @@ -49,13 +49,15 @@ def begin_registeration(request):
def complete_reg(request):
"""Completes the registeration, 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"})
data = cbor.decode(request.body)

client_data = CollectedClientData(data['clientDataJSON'])
att_obj = AttestationObject((data['attestationObject']))
server = getServer()
auth_data = server.register_complete(
request.session['fido_state'],
request.session.pop['fido_state'],
client_data,
att_obj
)
Expand All @@ -75,7 +77,7 @@ def complete_reg(request):
client.captureException()
except:
pass
return HttpResponse(simplejson.dumps({'status': 'ERR', "message": "Error on server, please try again later"}))
return JsonResponse({'status': 'ERR', "message": "Error on server, please try again later"})


def start(request):
Expand Down

0 comments on commit 54db5a5

Please sign in to comment.