From eada998945bde1fa97abd6c784a08a5e1dd4c466 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 20 Jul 2018 00:14:51 +0200 Subject: [PATCH 3/4] use new password widget in manager (#25045) --- src/authentic2/manager/forms.py | 8 +++----- .../manager/templates/authentic2/manager/form.html | 12 +++++++++++- src/authentic2/manager/views.py | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/authentic2/manager/forms.py b/src/authentic2/manager/forms.py index 870fb3db..d94b6b11 100644 --- a/src/authentic2/manager/forms.py +++ b/src/authentic2/manager/forms.py @@ -12,6 +12,7 @@ from django.core.exceptions import ValidationError from authentic2.compat import get_user_model from authentic2.passwords import generate_password from authentic2.utils import send_templated_mail +from authentic2.forms.fields import NewPasswordField, CheckPasswordField from django_rbac.models import Operation from django_rbac.utils import get_ou_model, get_role_model, get_permission_model @@ -288,14 +289,11 @@ class UserChangePasswordForm(CssClass, forms.ModelForm): initial=False, label=_('Generate new password'), required=False) - password1 = forms.CharField( + password1 = NewPasswordField( label=_("Password"), - widget=forms.PasswordInput, required=False) - password2 = forms.CharField( + password2 = CheckPasswordField( label=_("Confirmation"), - widget=forms.PasswordInput, - help_text=_("Enter the same password as above, for verification."), required=False) send_mail = forms.BooleanField( initial=True, diff --git a/src/authentic2/manager/templates/authentic2/manager/form.html b/src/authentic2/manager/templates/authentic2/manager/form.html index 83f7cda5..31e5fe79 100644 --- a/src/authentic2/manager/templates/authentic2/manager/form.html +++ b/src/authentic2/manager/templates/authentic2/manager/form.html @@ -7,6 +7,16 @@ {% endif %} {% endblock %} +{% block css %} +{{ block.super }} +{{ form.media.css }} +{% endblock %} + +{% block js %} +{{ block.super }} +{{ form.media.js }} +{% endblock %} + {% block content %}
{{ field.help_text }} + {{ field.help_text|safe }} {% endif %} {% if field.errors %}