diff --git a/common/djangoapps/student/forms.py b/common/djangoapps/student/forms.py index 81038f5076..e272a02a1a 100644 --- a/common/djangoapps/student/forms.py +++ b/common/djangoapps/student/forms.py @@ -48,7 +48,7 @@ class PasswordResetFormNoActive(PasswordResetForm): def save( self, domain_override=None, - subject_template_name='registration/password_reset_subject.txt', + subject_template_name='emails/password_reset_subject.txt', email_template_name='registration/password_reset_email.html', use_https=False, token_generator=default_token_generator, diff --git a/common/djangoapps/student/tests/test_reset_password.py b/common/djangoapps/student/tests/test_reset_password.py index 75f4547d8e..9b4fbbfcd6 100644 --- a/common/djangoapps/student/tests/test_reset_password.py +++ b/common/djangoapps/student/tests/test_reset_password.py @@ -301,3 +301,21 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): self.assertEquals(confirm_kwargs['extra_context']['platform_name'], 'Fake University') self.user = User.objects.get(pk=self.user.pk) self.assertTrue(self.user.is_active) + + @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS") + @patch('django.core.mail.send_mail') + @ddt.data('Crazy Awesome Site', 'edX') + def test_reset_password_email_subject(self, platform_name, send_email): + """ + Tests that the right platform name is included in + the reset password email subject + """ + with patch("django.conf.settings.PLATFORM_NAME", platform_name): + req = self.request_factory.post( + '/password_reset/', {'email': self.user.email} + ) + req.user = self.user + password_reset(req) + subj, _, _, _ = send_email.call_args[0] + + self.assertIn(platform_name, subj) diff --git a/lms/templates/emails/password_reset_subject.txt b/lms/templates/emails/password_reset_subject.txt new file mode 100644 index 0000000000..cf927ce629 --- /dev/null +++ b/lms/templates/emails/password_reset_subject.txt @@ -0,0 +1,4 @@ +{% load i18n %} +{% autoescape off %} +{% blocktrans %}Password reset on {{ platform_name }}{% endblocktrans %} +{% endautoescape %}