From 4f6eaa59d1c17857869b17f03ad432cd91e76508 Mon Sep 17 00:00:00 2001 From: Salah Alomari Date: Sun, 9 Apr 2017 14:11:47 +0300 Subject: [PATCH] Use platform_name instead of site_name in password reset email --- .../student/tests/test_reset_password.py | 18 +++++++++++------- .../registration/password_reset_email.html | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/common/djangoapps/student/tests/test_reset_password.py b/common/djangoapps/student/tests/test_reset_password.py index 0a973060fd..75f4547d8e 100644 --- a/common/djangoapps/student/tests/test_reset_password.py +++ b/common/djangoapps/student/tests/test_reset_password.py @@ -185,18 +185,22 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): req = self.request_factory.post( '/password_reset/', {'email': self.user.email} ) + req.is_secure = Mock(return_value=True) req.get_host = Mock(return_value=domain_override) req.user = self.user password_reset(req) _, msg, _, _ = send_email.call_args[0] - reset_msg = "you requested a password reset for your user account at {}" - if domain_override: - reset_msg = reset_msg.format(domain_override) - else: - reset_msg = reset_msg.format(settings.SITE_NAME) + reset_intro_msg = "you requested a password reset for your user account at {}".format(platform_name) + self.assertIn(reset_intro_msg, msg) - self.assertIn(reset_msg, msg) + reset_link = "https://{}/" + if domain_override: + reset_link = reset_link.format(domain_override) + else: + reset_link = reset_link.format(settings.SITE_NAME) + + self.assertIn(reset_link, msg) sign_off = "The {} Team".format(platform_name) self.assertIn(sign_off, msg) @@ -221,7 +225,7 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase): password_reset(req) _, msg, from_addr, _ = send_email.call_args[0] - reset_msg = "you requested a password reset for your user account at openedx.localhost" + reset_msg = "you requested a password reset for your user account at {}".format(fake_get_value('platform_name')) self.assertIn(reset_msg, msg) diff --git a/lms/templates/registration/password_reset_email.html b/lms/templates/registration/password_reset_email.html index 494d9f71d9..593ec66feb 100644 --- a/lms/templates/registration/password_reset_email.html +++ b/lms/templates/registration/password_reset_email.html @@ -1,5 +1,5 @@ {% load i18n %}{% autoescape off %} -{% blocktrans %}You're receiving this e-mail because you requested a password reset for your user account at {{ site_name }}.{% endblocktrans %} +{% blocktrans %}You're receiving this e-mail because you requested a password reset for your user account at {{ platform_name }}.{% endblocktrans %} {% trans "Please go to the following page and choose a new password:" %} {% block reset_link %}