0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Fixed #31978 -- Added username hint to admin's password reset confirmation form.

This commit is contained in:
Collin Anderson 2020-08-19 13:54:30 -04:00 committed by Mariusz Felisiak
parent 6a881197e9
commit daa26acc4e
2 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,7 @@
<form method="post">{% csrf_token %}
<fieldset class="module aligned">
<input style="display: none;" autocomplete="username" value="{{ form.user.username }}">
<div class="form-row field-password1">
{{ form.new_password1.errors }}
<label for="id_new_password1">{% translate 'New password:' %}</label>

View File

@ -52,6 +52,12 @@ class AuthTemplateTests(TestCase):
response = client.get(url)
self.assertContains(response, '<title>Enter new password</title>')
self.assertContains(response, '<h1>Enter new password</h1>')
# The username is added to the password reset confirmation form to help
# browser's password managers.
self.assertContains(
response,
'<input style="display: none;" autocomplete="username" value="jsmith">',
)
def test_PasswordResetCompleteView(self):
response = PasswordResetCompleteView.as_view()(self.request)