diff options
| author | Oliver Sauder <oliver.sauder@adfinis-sygroup.ch> | 2016-06-08 17:37:26 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-06-09 12:18:15 -0400 |
| commit | 5d8375fe662f636aff338a70ffa49644f9f53b39 (patch) | |
| tree | 8314a84272800f27efb35f2781456352cbce3238 | |
| parent | 686a593aaadb1c2e2053fee8c401476dcb4617a5 (diff) | |
Fixed #4548 -- Added username hint to admin's change_password form.
| -rw-r--r-- | django/contrib/admin/templates/admin/auth/user/change_password.html | 1 | ||||
| -rw-r--r-- | tests/admin_views/tests.py | 13 |
2 files changed, 9 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 3f13be2b5c..ee4dc6d08d 100644 --- a/django/contrib/admin/templates/admin/auth/user/change_password.html +++ b/django/contrib/admin/templates/admin/auth/user/change_password.html @@ -20,6 +20,7 @@ {% endif %} {% block content %}<div id="content-main"> <form action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %} +<input type="text" name="username" value="{{ original.get_username }}" style="display: none" /> <div> {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %} {% if form.errors %} diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index e706ba7105..ddd050e746 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -958,15 +958,18 @@ class AdminCustomTemplateTests(AdminViewBasicTestCase): response = self.client.get(reverse('admin:admin_views_section_add')) self.assertContains(response, 'bodyclass_consistency_check ') - def test_extended_bodyclass_template_change_password(self): - """ - Ensure that the auth/user/change_password.html template uses block - super in the bodyclass block. - """ + def test_change_password_template(self): user = User.objects.get(username='super') response = self.client.get(reverse('admin:auth_user_password_change', args=(user.id,))) + # The auth/user/change_password.html template uses super in the + # bodyclass block. self.assertContains(response, 'bodyclass_consistency_check ') + # When a site has multiple passwords in the browser's password manager, + # a browser pop up asks which user the new password is for. To prevent + # this, the username is added to the change password form. + self.assertContains(response, '<input type="text" name="username" value="super" style="display: none" />') + def test_extended_bodyclass_template_index(self): """ Ensure that the admin/index.html template uses block.super in the |
