Fixed #23948 -- Moved password help text from the template to the form.

Thanks Mithos for the report and patch.
This commit is contained in:
Tim Graham 2014-12-26 08:06:41 -05:00
parent 3325ec869c
commit 271d4f8f85
3 changed files with 21 additions and 5 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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