From 0cdd9b6968b98090e548ffd3adddb8ad4482e3d6 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 | 2 +- 2 files changed, 4 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..7b8b40a7 100644 --- a/src/authentic2/manager/templates/authentic2/manager/form.html +++ b/src/authentic2/manager/templates/authentic2/manager/form.html @@ -44,7 +44,7 @@ {{ field.label_tag }} {{ field }} {% if field.help_text %} - {{ field.help_text }} + {{ field.help_text|safe }} {% endif %} {% if field.errors %}