django-mfa3

multi factor authentication for django
git clone https://git.ce9e.org/django-mfa3.git

commit
d5f28408047eb6bdffc8b567e65890a56eaf8303
parent
0aee417952cac145c6a6e07df87c27f7433f824f
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-02-27 15:37
autofocus in auth form

Diffstat

M mfa/forms.py 10 ++++++++--

1 files changed, 8 insertions, 2 deletions


diff --git a/mfa/forms.py b/mfa/forms.py

@@ -2,7 +2,7 @@ from django import forms
    2     2 from django.utils.translation import gettext_lazy as _
    3     3 
    4     4 
    5    -1 class MFAAuthForm(forms.Form):
   -1     5 class MFABaseForm(forms.Form):
    6     6     code = forms.CharField(label=_('Authentication code'))
    7     7 
    8     8     def __init__(self, validate_code=None, **kwargs):
@@ -20,5 +20,11 @@ class MFAAuthForm(forms.Form):
   20    20         return cleaned_data
   21    21 
   22    22 
   23    -1 class MFACreateForm(MFAAuthForm):
   -1    23 class MFAAuthForm(MFABaseForm):
   -1    24     def __init__(self, **kwargs):
   -1    25         super().__init__(**kwargs)
   -1    26         self.fields['code'].widget.attrs.update({'autofocus': True})
   -1    27 
   -1    28 
   -1    29 class MFACreateForm(MFABaseForm):
   24    30     name = forms.CharField(label=_('Name'), max_length=32)