summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-04-19 12:59:30 -0400
committerGitHub <noreply@github.com>2017-04-19 12:59:30 -0400
commitdff559ff83a6aac14de0bbca58101786edf4195f (patch)
treead630eb09ba1aaf8989dc4294c7855611ec9f56d
parentcd7afcdcac69cc4e6f762188262957bceb4760e0 (diff)
Fixed #28097 -- Fixed layout of ReadOnlyPasswordHashWidget.
-rw-r--r--django/contrib/auth/templates/auth/widgets/read_only_password_hash.html4
-rw-r--r--docs/releases/1.11.1.txt3
-rw-r--r--tests/auth_tests/test_forms.py16
3 files changed, 22 insertions, 1 deletions
diff --git a/django/contrib/auth/templates/auth/widgets/read_only_password_hash.html b/django/contrib/auth/templates/auth/widgets/read_only_password_hash.html
index b411298d74..a2a12c6f10 100644
--- a/django/contrib/auth/templates/auth/widgets/read_only_password_hash.html
+++ b/django/contrib/auth/templates/auth/widgets/read_only_password_hash.html
@@ -1,3 +1,5 @@
+<div{% include 'django/forms/widgets/attrs.html' %}>
{% for entry in summary %}
-<div{% include 'django/forms/widgets/attrs.html' %}><strong>{{ entry.label }}</strong>{% if entry.value %}: {{ entry.value }}{% endif %}
+<strong>{{ entry.label }}</strong>{% if entry.value %}: {{ entry.value }}{% endif %}
{% endfor %}
+</div>
diff --git a/docs/releases/1.11.1.txt b/docs/releases/1.11.1.txt
index 41f82a0c63..26ff892731 100644
--- a/docs/releases/1.11.1.txt
+++ b/docs/releases/1.11.1.txt
@@ -30,3 +30,6 @@ Bugfixes
* Prevented ``SessionBase.cycle_key()`` from losing session data if
``_session_cache`` isn't populated (:ticket:`28066`).
+
+* Fixed layout of ``ReadOnlyPasswordHashWidget`` (used in the admin's user
+ change page) (:ticket:`28097`).
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index 68bcd892a1..05f1f41961 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -825,6 +825,22 @@ class ReadOnlyPasswordHashTest(SimpleTestCase):
html = widget.render(name='password', value=None, attrs={})
self.assertIn(_("No password set."), html)
+ @override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.PBKDF2PasswordHasher'])
+ def test_render(self):
+ widget = ReadOnlyPasswordHashWidget()
+ value = 'pbkdf2_sha256$100000$a6Pucb1qSFcD$WmCkn9Hqidj48NVe5x0FEM6A9YiOqQcl/83m2Z5udm0='
+ self.assertHTMLEqual(
+ widget.render('name', value, {'id': 'id_password'}),
+ """
+ <div id="id_password">
+ <strong>algorithm</strong>: pbkdf2_sha256
+ <strong>iterations</strong>: 100000
+ <strong>salt</strong>: a6Pucb******
+ <strong>hash</strong>: WmCkn9**************************************
+ </div>
+ """
+ )
+
def test_readonly_field_has_changed(self):
field = ReadOnlyPasswordHashField()
self.assertFalse(field.has_changed('aaa', 'bbb'))