From 6c1def8a881b0eb46875d32fb5f5f401c4748300 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 20 Jul 2018 00:14:51 +0200 Subject: [PATCH] use new password widget in manager (#25045) --- src/authentic2/manager/forms.py | 8 ++--- .../templates/authentic2/manager/form.html | 2 +- tests/test_manager.py | 32 +++++++++---------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/src/authentic2/manager/forms.py b/src/authentic2/manager/forms.py index adda87c15..94a99bbda 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 83f7cda57..7b8b40a72 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 %}