File: forms.rst

package info (click to toggle)
django-allauth 65.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,672 kB
  • sloc: python: 34,411; javascript: 3,070; xml: 849; makefile: 235; sh: 8
file content (101 lines) | stat: -rw-r--r-- 2,288 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
Forms
=====

(Re)authenticate
****************

*Path*
  ``allauth.mfa.base.forms.AuthenticateForm``
  ``allauth.mfa.base.forms.ReauthenticateForm``
  ``allauth.mfa.webauthn.forms.AuthenticateWebAuthnForm``

*Used on*:
  AuthenticateView and ReauthenticateView, used when a user authenticates with MFA.

Example override::

    from allauth.mfa.base.forms import AuthenticateForm, ReauthenticateForm
    from allauth.mfa.webauthn.forms import AuthenticateWebAuthnForm


    class MyCustomAuthenticateForm(AuthenticateForm):
        pass


    class MyCustomReauthenticateForm(ReauthenticateForm):
        pass


    class MyCustomAuthenticateWebAuthnForm(AuthenticateWebAuthnForm):
        pass

``settings.py``::

    MFA_FORMS = {
        'authenticate': 'mysite.forms.MyCustomAuthenticateForm',
        'reauthenticate': 'mysite.forms.MyCustomReauthenticateForm',
        'authenticate_webauthn: 'mysite.forms.MyCustomAuthenticateWebAuthnForm',
    }

Activate TOTP
*************

*Path*
  ``allauth.mfa.totp.forms.ActivateTOTPForm``

*Used on*:
  ActivateTOTPView, used when a user activates TOTP.

Example override::

    from allauth.mfa.totp.forms import ActivateTOTPForm
    class MyCustomActivateTOTPForm(ActivateTOTPForm):
      pass

``settings.py``::

    MFA_FORMS = {
        'activate_totp': 'mysite.forms.MyCustomActivateTOTPForm',
    }

Deactivate TOTP
***************

*Path*
  ``allauth.mfa.totp.forms.DeactivateTOTPForm``

*Used on*:
  DeactivateTOTPView, used when a user deactivates TOTP.

Example override::

    from allauth.mfa.totp.forms import DeactivateTOTPForm
    class MyCustomDeactivateTOTPForm(DeactivateTOTPForm):
      pass

``settings.py``::

    MFA_FORMS = {
        'deactivate_totp': 'mysite.forms.MyCustomDeactivateTOTPForm',
    }

Generate Recovery Codes
***********************

*Path*
  ``allauth.mfa.recovery_codes.forms.GenerateRecoveryCodesForm``

*Used on*:
  GenerateRecoveryCodesView, used when a user generates recovery codes.

Example override::

    from allauth.mfa.recovery_codes.forms import GenerateRecoveryCodesForm
    class MyCustomGenerateRecoveryCodesForm(GenerateRecoveryCodesForm):
      pass

``settings.py``::

    MFA_FORMS = {
        'generate_recovery_codes': 'mysite.forms.MyCustomGenerateRecoveryCodesForm',
    }