Projet

Général

Profil

0002-use-new-password-widget-in-login-form-25045.patch

Benjamin Dauvergne, 02 août 2018 17:02

Télécharger (2,28 ko)

Voir les différences:

Subject: [PATCH 2/4] 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.
 src/authentic2/forms/__init__.py                         | 9 +++++++++
 .../templates/authentic2/login_password_form.html        | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
src/authentic2/forms/__init__.py
7 7
from django.utils import html
8 8

  
9 9
from authentic2.compat import get_user_model
10
from authentic2.forms.fields import PasswordField
10 11

  
11 12
from .. import app_settings
12 13
from ..exponential_retry_timeout import ExponentialRetryTimeout
......
157 158

  
158 159

  
159 160
class AuthenticationForm(auth_forms.AuthenticationForm):
161
    password = PasswordField(label=_('Password'))
162

  
160 163
    def __init__(self, *args, **kwargs):
161 164
        super(AuthenticationForm, self).__init__(*args, **kwargs)
162 165
        self.exponential_backoff = ExponentialRetryTimeout(
......
200 203
                self.exponential_backoff.success(*keys)
201 204
        return self.cleaned_data
202 205

  
206
    @property
207
    def media(self):
208
        media = super(AuthenticationForm, self).media
209
        media.add_js(['authentic2/js/js_seconds_until.js'])
210
        return media
211

  
203 212

  
204 213
class SiteImportForm(forms.Form):
205 214
    site_json = forms.FileField(label=_('Site Export File'))
src/authentic2/templates/authentic2/login_password_form.html
19 19
{% endif %}
20 20
</div>
21 21

  
22
<script type="text/javascript" src="{% static "authentic2/js/js_seconds_until.js" %}" async></script>
22
{{ form.media }}
23
-