From 53c0d16ac1d45ddc973fdffb6a6ee95c55a6fb3d Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Thu, 10 Sep 2020 02:53:09 -0700 Subject: [PATCH] Fixed #31992 -- Made admin password reset templates use title/content_title blocks from the base template. --- .../registration/password_change_done.html | 2 -- .../registration/password_change_form.html | 3 --- .../registration/password_reset_complete.html | 3 --- .../registration/password_reset_confirm.html | 2 -- .../registration/password_reset_done.html | 2 -- .../registration/password_reset_form.html | 2 -- tests/auth_tests/test_templates.py | 14 +++++++------- 7 files changed, 7 insertions(+), 21 deletions(-) diff --git a/django/contrib/admin/templates/registration/password_change_done.html b/django/contrib/admin/templates/registration/password_change_done.html index 9cc85f8361..e1bb982aba 100644 --- a/django/contrib/admin/templates/registration/password_change_done.html +++ b/django/contrib/admin/templates/registration/password_change_done.html @@ -8,8 +8,6 @@ {% endblock %} -{% block title %}{{ title }}{% endblock %} -{% block content_title %}

{{ title }}

{% endblock %} {% block content %}

{% translate 'Your password was changed.' %}

{% endblock %} diff --git a/django/contrib/admin/templates/registration/password_change_form.html b/django/contrib/admin/templates/registration/password_change_form.html index d3a9bf305d..95c84f922d 100644 --- a/django/contrib/admin/templates/registration/password_change_form.html +++ b/django/contrib/admin/templates/registration/password_change_form.html @@ -9,9 +9,6 @@ {% endblock %} -{% block title %}{{ title }}{% endblock %} -{% block content_title %}

{{ title }}

{% endblock %} - {% block content %}
{% csrf_token %} diff --git a/django/contrib/admin/templates/registration/password_reset_complete.html b/django/contrib/admin/templates/registration/password_reset_complete.html index 396f339841..e6a383fcfe 100644 --- a/django/contrib/admin/templates/registration/password_reset_complete.html +++ b/django/contrib/admin/templates/registration/password_reset_complete.html @@ -8,9 +8,6 @@
{% endblock %} -{% block title %}{{ title }}{% endblock %} -{% block content_title %}

{{ title }}

{% endblock %} - {% block content %}

{% translate "Your password has been set. You may go ahead and log in now." %}

diff --git a/django/contrib/admin/templates/registration/password_reset_confirm.html b/django/contrib/admin/templates/registration/password_reset_confirm.html index 7de22336cf..e587c6498c 100644 --- a/django/contrib/admin/templates/registration/password_reset_confirm.html +++ b/django/contrib/admin/templates/registration/password_reset_confirm.html @@ -9,8 +9,6 @@ {% endblock %} -{% block title %}{{ title }}{% endblock %} -{% block content_title %}

{{ title }}

{% endblock %} {% block content %} {% if validlink %} diff --git a/django/contrib/admin/templates/registration/password_reset_done.html b/django/contrib/admin/templates/registration/password_reset_done.html index 1f6e83aaaf..8b1971a76e 100644 --- a/django/contrib/admin/templates/registration/password_reset_done.html +++ b/django/contrib/admin/templates/registration/password_reset_done.html @@ -8,8 +8,6 @@ {% endblock %} -{% block title %}{{ title }}{% endblock %} -{% block content_title %}

{{ title }}

{% endblock %} {% block content %}

{% translate 'We’ve emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.' %}

diff --git a/django/contrib/admin/templates/registration/password_reset_form.html b/django/contrib/admin/templates/registration/password_reset_form.html index d5493d9d61..33785f7c14 100644 --- a/django/contrib/admin/templates/registration/password_reset_form.html +++ b/django/contrib/admin/templates/registration/password_reset_form.html @@ -9,8 +9,6 @@ {% endblock %} -{% block title %}{{ title }}{% endblock %} -{% block content_title %}

{{ title }}

{% endblock %} {% block content %}

{% translate 'Forgotten your password? Enter your email address below, and we’ll email instructions for setting a new one.' %}

diff --git a/tests/auth_tests/test_templates.py b/tests/auth_tests/test_templates.py index 9651bf585d..b9db10763c 100644 --- a/tests/auth_tests/test_templates.py +++ b/tests/auth_tests/test_templates.py @@ -26,12 +26,12 @@ class AuthTemplateTests(TestCase): def test_PasswordResetView(self): response = PasswordResetView.as_view(success_url='dummy/')(self.request) - self.assertContains(response, 'Password reset') + self.assertContains(response, 'Password reset | Django site admin') self.assertContains(response, '

Password reset

') def test_PasswordResetDoneView(self): response = PasswordResetDoneView.as_view()(self.request) - self.assertContains(response, 'Password reset sent') + self.assertContains(response, 'Password reset sent | Django site admin') self.assertContains(response, '

Password reset sent

') def test_PasswordResetConfirmView_invalid_token(self): @@ -39,7 +39,7 @@ class AuthTemplateTests(TestCase): client = PasswordResetConfirmClient() url = reverse('password_reset_confirm', kwargs={'uidb64': 'Bad', 'token': 'Bad-Token'}) response = client.get(url) - self.assertContains(response, 'Password reset unsuccessful') + self.assertContains(response, 'Password reset unsuccessful | Django site admin') self.assertContains(response, '

Password reset unsuccessful

') def test_PasswordResetConfirmView_valid_token(self): @@ -50,7 +50,7 @@ class AuthTemplateTests(TestCase): uidb64 = urlsafe_base64_encode(str(self.user.pk).encode()) url = reverse('password_reset_confirm', kwargs={'uidb64': uidb64, 'token': token}) response = client.get(url) - self.assertContains(response, 'Enter new password') + self.assertContains(response, 'Enter new password | Django site admin') self.assertContains(response, '

Enter new password

') # The username is added to the password reset confirmation form to help # browser's password managers. @@ -61,15 +61,15 @@ class AuthTemplateTests(TestCase): def test_PasswordResetCompleteView(self): response = PasswordResetCompleteView.as_view()(self.request) - self.assertContains(response, 'Password reset complete') + self.assertContains(response, 'Password reset complete | Django site admin') self.assertContains(response, '

Password reset complete

') def test_PasswordResetChangeView(self): response = PasswordChangeView.as_view(success_url='dummy/')(self.request) - self.assertContains(response, 'Password change') + self.assertContains(response, 'Password change | Django site admin') self.assertContains(response, '

Password change

') def test_PasswordChangeDoneView(self): response = PasswordChangeDoneView.as_view()(self.request) - self.assertContains(response, 'Password change successful') + self.assertContains(response, 'Password change successful | Django site admin') self.assertContains(response, '

Password change successful

')