use new password widget in login form (#25045)
This commit also modify AuthenticationForm to remove explicit loading of authentic2/js/js_seconds_until.html from login_password.html.
This commit is contained in:
parent
4a39fc64f2
commit
26befb8fe2
|
@ -7,6 +7,7 @@ from django.contrib.auth import REDIRECT_FIELD_NAME, forms as auth_forms
|
|||
from django.utils import html
|
||||
|
||||
from authentic2.compat import get_user_model
|
||||
from authentic2.forms.fields import PasswordField
|
||||
|
||||
from .. import app_settings
|
||||
from ..exponential_retry_timeout import ExponentialRetryTimeout
|
||||
|
@ -157,6 +158,8 @@ def modelform_factory(model, **kwargs):
|
|||
|
||||
|
||||
class AuthenticationForm(auth_forms.AuthenticationForm):
|
||||
password = PasswordField(label=_('Password'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(AuthenticationForm, self).__init__(*args, **kwargs)
|
||||
self.exponential_backoff = ExponentialRetryTimeout(
|
||||
|
@ -200,6 +203,12 @@ class AuthenticationForm(auth_forms.AuthenticationForm):
|
|||
self.exponential_backoff.success(*keys)
|
||||
return self.cleaned_data
|
||||
|
||||
@property
|
||||
def media(self):
|
||||
media = super(AuthenticationForm, self).media
|
||||
media.add_js(['authentic2/js/js_seconds_until.js'])
|
||||
return media
|
||||
|
||||
|
||||
class SiteImportForm(forms.Form):
|
||||
site_json = forms.FileField(label=_('Site Export File'))
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="{% static "authentic2/js/js_seconds_until.js" %}" async></script>
|
||||
{{ form.media }}
|
||||
|
|
Loading…
Reference in New Issue