serializers/two_factor_auth.md
Two-Factor Authentication Serializer
Description
Manages enabling or disabling two-factor authentication for users.
Fields
| Field | Description | Required |
|---|---|---|
email |
User's email address. | Yes |
is_enabled |
Boolean to enable or disable 2FA. | No |
totp_secret |
Secret key for generating OTPs. | Read-only |
created_at |
Timestamp for when the configuration was created. | Read-only |
updated_at |
Timestamp for the last configuration update. | Read-only |
Validation
- Ensures the email exists in the database before performing any operations.
Examples
Request Payload to Enable 2FA:
{
"email": "example@domain.com",
"is_enabled": true
}