Debian Codegraph @

docs/mfa/forms.rst

raw
1 Forms
2 =====
3
4 (Re)authenticate
5 ****************
6
7 *Path*
8 ``allauth.mfa.base.forms.AuthenticateForm``
9 ``allauth.mfa.base.forms.ReauthenticateForm``
10 ``allauth.mfa.webauthn.forms.AuthenticateWebAuthnForm``
11
12 *Used on*:
13 AuthenticateView and ReauthenticateView, used when a user authenticates with MFA.
14
15 Example override::
16
17 from allauth.mfa.base.forms import AuthenticateForm, ReauthenticateForm
18 from allauth.mfa.webauthn.forms import AuthenticateWebAuthnForm
19
20
21 class MyCustomAuthenticateForm(AuthenticateForm):
22 pass
23
24
25 class MyCustomReauthenticateForm(ReauthenticateForm):
26 pass
27
28
29 class MyCustomAuthenticateWebAuthnForm(AuthenticateWebAuthnForm):
30 pass
31
32 ``settings.py``::
33
34 MFA_FORMS = {
35 'authenticate': 'mysite.forms.MyCustomAuthenticateForm',
36 'reauthenticate': 'mysite.forms.MyCustomReauthenticateForm',
37 'authenticate_webauthn': 'mysite.forms.MyCustomAuthenticateWebAuthnForm',
38 }
39
40 Activate TOTP
41 *************
42
43 *Path*
44 ``allauth.mfa.totp.forms.ActivateTOTPForm``
45
46 *Used on*:
47 ActivateTOTPView, used when a user activates TOTP.
48
49 Example override::
50
51 from allauth.mfa.totp.forms import ActivateTOTPForm
52 class MyCustomActivateTOTPForm(ActivateTOTPForm):
53 pass
54
55 ``settings.py``::
56
57 MFA_FORMS = {
58 'activate_totp': 'mysite.forms.MyCustomActivateTOTPForm',
59 }
60
61 Deactivate TOTP
62 ***************
63
64 *Path*
65 ``allauth.mfa.totp.forms.DeactivateTOTPForm``
66
67 *Used on*:
68 DeactivateTOTPView, used when a user deactivates TOTP.
69
70 Example override::
71
72 from allauth.mfa.totp.forms import DeactivateTOTPForm
73 class MyCustomDeactivateTOTPForm(DeactivateTOTPForm):
74 pass
75
76 ``settings.py``::
77
78 MFA_FORMS = {
79 'deactivate_totp': 'mysite.forms.MyCustomDeactivateTOTPForm',
80 }
81
82 Generate Recovery Codes
83 ***********************
84
85 *Path*
86 ``allauth.mfa.recovery_codes.forms.GenerateRecoveryCodesForm``
87
88 *Used on*:
89 GenerateRecoveryCodesView, used when a user generates recovery codes.
90
91 Example override::
92
93 from allauth.mfa.recovery_codes.forms import GenerateRecoveryCodesForm
94 class MyCustomGenerateRecoveryCodesForm(GenerateRecoveryCodesForm):
95 pass
96
97 ``settings.py``::
98
99 MFA_FORMS = {
100 'generate_recovery_codes': 'mysite.forms.MyCustomGenerateRecoveryCodesForm',
101 }