Adapter
- class allauth.mfa.adapter.DefaultMFAAdapter(request=None)
The adapter class allows you to override various functionality of the
allauth.mfa
app. To do so, pointsettings.MFA_ADAPTER
to your own class that derives fromDefaultMFAAdapter
and override the behavior by altering the implementation of the methods according to your own needs.- decrypt(encrypted_text: str) str
Counter part of
encrypt()
.
- encrypt(text: str) str
Secrets such as the TOTP key are stored in the database. This hook can be used to encrypt those so that they are not stored in the clear in the database.
- error_messages = {'add_email_blocked': 'You cannot add an email address to an account protected by two-factor authentication.', 'cannot_delete_authenticator': 'You cannot deactivate two-factor authentication.', 'cannot_generate_recovery_codes': 'You cannot generate recovery codes without having two-factor authentication enabled.', 'incorrect_code': 'Incorrect code.', 'unverified_email': 'You cannot activate two-factor authentication until you have verified your email address.'}
The error messages that can occur as part of MFA form handling.
- generate_authenticator_name(user, type: Type) str
Generate a human friendly name for the key. Used to prefill the “Add key” form.
- get_totp_issuer() str
Returns the TOTP issuer name that will be contained in the TOTP QR code.
- get_totp_label(user) str
Returns the label used for representing the given user in a TOTP QR code.
- is_mfa_enabled(user, types=None) bool
Returns
True
if (and only if) the user has 2FA enabled.