mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #28097 -- Fixed layout of ReadOnlyPasswordHashWidget.
This commit is contained in:
		| @@ -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> | ||||
|   | ||||
| @@ -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`). | ||||
|   | ||||
| @@ -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')) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user