From 271d4f8f85edf6dacc391ff5ddf601e3ee185b53 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 26 Dec 2014 08:06:41 -0500 Subject: [PATCH] Fixed #23948 -- Moved password help text from the template to the form. Thanks Mithos for the report and patch. --- .../templates/admin/auth/user/change_password.html | 7 ++++++- .../registration/password_change_form.html | 6 ++++++ django/contrib/auth/forms.py | 13 +++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/django/contrib/admin/templates/admin/auth/user/change_password.html b/django/contrib/admin/templates/admin/auth/user/change_password.html index 8bbc4484c0..bfffd2a77b 100644 --- a/django/contrib/admin/templates/admin/auth/user/change_password.html +++ b/django/contrib/admin/templates/admin/auth/user/change_password.html @@ -35,12 +35,17 @@
{{ form.password1.errors }} {{ form.password1.label_tag }} {{ form.password1 }} + {% if form.password1.help_text %} +

{{ form.password1.help_text }}

+ {% endif %}
{{ form.password2.errors }} {{ form.password2.label_tag }} {{ form.password2 }} -

{% trans 'Enter the same password as above, for verification.' %}

+ {% if form.password2.help_text %} +

{{ form.password2.help_text }}

+ {% endif %}
diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html index 6c1118de00..1e641dcc09 100644 --- a/django/contrib/admin/templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -35,11 +35,17 @@
{{ form.new_password1.errors }} {{ form.new_password1.label_tag }} {{ form.new_password1 }} + {% if form.new_password1.help_text %} +

{{ form.new_password1.help_text }}

+ {% endif %}
{{ form.new_password2.errors }} {{ form.new_password2.label_tag }} {{ form.new_password2 }} + {% if form.new_password2.help_text %} +

{{ form.new_password2.help_text }}

+ {% endif %}
diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index 86cfa291c9..d410bbb9bc 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -337,10 +337,15 @@ class AdminPasswordChangeForm(forms.Form): 'password_mismatch': _("The two password fields didn't match."), } required_css_class = 'required' - password1 = forms.CharField(label=_("Password"), - widget=forms.PasswordInput) - password2 = forms.CharField(label=_("Password (again)"), - widget=forms.PasswordInput) + password1 = forms.CharField( + label=_("Password"), + widget=forms.PasswordInput, + ) + password2 = forms.CharField( + label=_("Password (again)"), + widget=forms.PasswordInput, + help_text=_("Enter the same password as above, for verification."), + ) def __init__(self, user, *args, **kwargs): self.user = user