mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 09:45:17 -05:00
feat: Implement passkey authentication, account management features, and a dedicated MFA login verification flow.
This commit is contained in:
@@ -50,6 +50,10 @@ def get_mfa_status(request):
|
||||
|
||||
totp_enabled = authenticators.filter(type=Authenticator.Type.TOTP).exists()
|
||||
recovery_enabled = authenticators.filter(type=Authenticator.Type.RECOVERY_CODES).exists()
|
||||
|
||||
# Check for WebAuthn/Passkey authenticators
|
||||
passkey_enabled = authenticators.filter(type=Authenticator.Type.WEBAUTHN).exists()
|
||||
passkey_count = authenticators.filter(type=Authenticator.Type.WEBAUTHN).count()
|
||||
|
||||
# Count recovery codes if any
|
||||
recovery_count = 0
|
||||
@@ -60,12 +64,18 @@ def get_mfa_status(request):
|
||||
except Authenticator.DoesNotExist:
|
||||
pass
|
||||
|
||||
# has_second_factor is True if user has either TOTP or Passkey configured
|
||||
has_second_factor = totp_enabled or passkey_enabled
|
||||
|
||||
return Response(
|
||||
{
|
||||
"mfa_enabled": totp_enabled,
|
||||
"mfa_enabled": totp_enabled, # Backward compatibility
|
||||
"totp_enabled": totp_enabled,
|
||||
"passkey_enabled": passkey_enabled,
|
||||
"passkey_count": passkey_count,
|
||||
"recovery_codes_enabled": recovery_enabled,
|
||||
"recovery_codes_count": recovery_count,
|
||||
"has_second_factor": has_second_factor,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user