From fdf0f625216cc5a70d28a3ac9a41f41935f1827c Mon Sep 17 00:00:00 2001
From: Shai Berger <shai@platonix.com>
Date: Thu, 1 Sep 2022 00:39:08 +0300
Subject: [PATCH] Fixed ReadOnlyPasswordHashWidget's template for RTL
 languages.

---
 .../auth/widgets/read_only_password_hash.html     |  2 +-
 tests/auth_tests/test_forms.py                    | 15 +++++++--------
 tests/auth_tests/test_views.py                    |  6 +++---
 3 files changed, 11 insertions(+), 12 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 a2a12c6f10..c73042b18f 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,5 +1,5 @@
 <div{% include 'django/forms/widgets/attrs.html' %}>
 {% for entry in summary %}
-<strong>{{ entry.label }}</strong>{% if entry.value %}: {{ entry.value }}{% endif %}
+<strong>{{ entry.label }}</strong>{% if entry.value %}: <bdi>{{ entry.value }}</bdi>{% endif %}
 {% endfor %}
 </div>
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index ea52254123..98bf264040 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -1159,14 +1159,13 @@ class ReadOnlyPasswordHashTest(SimpleTestCase):
         )
         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>
-            """,
+            '<div id="id_password">'
+            "    <strong>algorithm</strong>: <bdi>pbkdf2_sha256</bdi>"
+            "    <strong>iterations</strong>: <bdi>100000</bdi>"
+            "    <strong>salt</strong>: <bdi>a6Pucb******</bdi>"
+            "    <strong>hash</strong>: "
+            "       <bdi>WmCkn9**************************************</bdi>"
+            "</div>",
         )
 
     def test_readonly_field_has_changed(self):
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
index 2941716422..5ea536151e 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -1519,9 +1519,9 @@ class ChangelistTests(AuthViewsTestCase):
         # ReadOnlyPasswordHashWidget is used to render the field.
         self.assertContains(
             response,
-            "<strong>algorithm</strong>: %s\n\n"
-            "<strong>salt</strong>: %s********************\n\n"
-            "<strong>hash</strong>: %s**************************\n\n"
+            "<strong>algorithm</strong>: <bdi>%s</bdi>\n\n"
+            "<strong>salt</strong>: <bdi>%s********************</bdi>\n\n"
+            "<strong>hash</strong>: <bdi>%s**************************</bdi>\n\n"
             % (
                 algo,
                 salt[:2],