diff options
| author | Tim Graham <timograham@gmail.com> | 2014-12-26 08:06:41 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-26 08:09:12 -0500 |
| commit | 271d4f8f85edf6dacc391ff5ddf601e3ee185b53 (patch) | |
| tree | 6982e15f55796a7718bd14a58bdfd3e62b528547 | |
| parent | 3325ec869c10aba0fcb52c826d79633818c14dbc (diff) | |
Fixed #23948 -- Moved password help text from the template to the form.
Thanks Mithos for the report and patch.
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 @@ <div class="form-row"> {{ form.password1.errors }} {{ form.password1.label_tag }} {{ form.password1 }} + {% if form.password1.help_text %} + <p class="help">{{ form.password1.help_text }}</p> + {% endif %} </div> <div class="form-row"> {{ form.password2.errors }} {{ form.password2.label_tag }} {{ form.password2 }} - <p class="help">{% trans 'Enter the same password as above, for verification.' %}</p> + {% if form.password2.help_text %} + <p class="help">{{ form.password2.help_text }}</p> + {% endif %} </div> </fieldset> 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 @@ <div class="form-row"> {{ form.new_password1.errors }} {{ form.new_password1.label_tag }} {{ form.new_password1 }} + {% if form.new_password1.help_text %} + <p class="help">{{ form.new_password1.help_text }}</p> + {% endif %} </div> <div class="form-row"> {{ form.new_password2.errors }} {{ form.new_password2.label_tag }} {{ form.new_password2 }} + {% if form.new_password2.help_text %} + <p class="help">{{ form.new_password2.help_text }}</p> + {% endif %} </div> </fieldset> 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 |
