- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
def auth_2FA(request):
mail = request.POST.get('mail')
user = User.objects.get(email=mail)
code2FA = request.POST.get('code2FA')
if pyotp.TOTP(user.secret).verify(code2FA):
auth.login(request, user)
return redirect(settings.HOME_PAGE)
else:
...