Commit a4119537 by Uman Shahzad

Allow configurable activation email support link.

This also serves as a slight refactor of ENT-392.
parent ea195ff2
...@@ -94,6 +94,7 @@ from lms.envs.common import ( ...@@ -94,6 +94,7 @@ from lms.envs.common import (
HELP_TOKENS_BOOKS, HELP_TOKENS_BOOKS,
SUPPORT_SITE_LINK, SUPPORT_SITE_LINK,
ACTIVATION_EMAIL_SUPPORT_LINK,
CONTACT_EMAIL, CONTACT_EMAIL,
......
...@@ -11,6 +11,7 @@ from uuid import uuid4 ...@@ -11,6 +11,7 @@ from uuid import uuid4
from edxmako.shortcuts import render_to_string from edxmako.shortcuts import render_to_string
from student.models import Registration from student.models import Registration
from student.tests.factories import UserFactory from student.tests.factories import UserFactory
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
...@@ -31,6 +32,11 @@ class TestActivateAccount(TestCase): ...@@ -31,6 +32,11 @@ class TestActivateAccount(TestCase):
self.registration.register(self.user) self.registration.register(self.user)
self.registration.save() self.registration.save()
self.platform_name = configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
self.activation_email_support_link = configuration_helpers.get_value(
'ACTIVATION_EMAIL_SUPPORT_LINK', settings.SUPPORT_SITE_LINK # Intentional default.
)
def login(self): def login(self):
""" """
Login with test user. Login with test user.
...@@ -118,7 +124,11 @@ class TestActivateAccount(TestCase): ...@@ -118,7 +124,11 @@ class TestActivateAccount(TestCase):
self.login() self.login()
expected_message = render_to_string( expected_message = render_to_string(
'registration/account_activation_sidebar_notice.html', 'registration/account_activation_sidebar_notice.html',
{'email': self.user.email} {
'email': self.user.email,
'platform_name': self.platform_name,
'activation_email_support_link': self.activation_email_support_link
}
) )
response = self.client.get(reverse('dashboard')) response = self.client.get(reverse('dashboard'))
...@@ -130,7 +140,11 @@ class TestActivateAccount(TestCase): ...@@ -130,7 +140,11 @@ class TestActivateAccount(TestCase):
self.login() self.login()
expected_message = render_to_string( expected_message = render_to_string(
'registration/account_activation_sidebar_notice.html', 'registration/account_activation_sidebar_notice.html',
{'email': self.user.email} {
'email': self.user.email,
'platform_name': self.platform_name,
'activation_email_support_link': self.activation_email_support_link
}
) )
response = self.client.get(reverse('dashboard')) response = self.client.get(reverse('dashboard'))
self.assertNotContains(response, expected_message, html=True) self.assertNotContains(response, expected_message, html=True)
......
...@@ -657,6 +657,9 @@ def dashboard(request): ...@@ -657,6 +657,9 @@ def dashboard(request):
'DISPLAY_COURSE_MODES_ON_DASHBOARD', 'DISPLAY_COURSE_MODES_ON_DASHBOARD',
settings.FEATURES.get('DISPLAY_COURSE_MODES_ON_DASHBOARD', True) settings.FEATURES.get('DISPLAY_COURSE_MODES_ON_DASHBOARD', True)
) )
activation_email_support_link = configuration_helpers.get_value(
'ACTIVATION_EMAIL_SUPPORT_LINK', settings.SUPPORT_SITE_LINK
)
# Let's filter out any courses in an "org" that has been declared to be # Let's filter out any courses in an "org" that has been declared to be
# in a configuration # in a configuration
...@@ -712,12 +715,16 @@ def dashboard(request): ...@@ -712,12 +715,16 @@ def dashboard(request):
if display_account_activation_message_on_sidebar and not user.is_active: if display_account_activation_message_on_sidebar and not user.is_active:
sidebar_account_activation_message = render_to_string( sidebar_account_activation_message = render_to_string(
'registration/account_activation_sidebar_notice.html', 'registration/account_activation_sidebar_notice.html',
{'email': user.email} {
'email': user.email,
'platform_name': platform_name,
'activation_email_support_link': activation_email_support_link
}
) )
elif not user.is_active: elif not user.is_active:
banner_account_activation_message = render_to_string( banner_account_activation_message = render_to_string(
'registration/activate_account_notice.html', 'registration/activate_account_notice.html',
{'email': user.email, 'platform_name': platform_name} {'email': user.email}
) )
enterprise_message = get_dashboard_consent_notification(request, user, course_enrollments) enterprise_message = get_dashboard_consent_notification(request, user, course_enrollments)
...@@ -727,11 +734,11 @@ def dashboard(request): ...@@ -727,11 +734,11 @@ def dashboard(request):
message for message in messages.get_messages(request) if 'account-activation' in message.tags message for message in messages.get_messages(request) if 'account-activation' in message.tags
] ]
# Global staff can see what courses errored on their dashboard # Global staff can see what courses encountered an error on their dashboard
staff_access = False staff_access = False
errored_courses = {} errored_courses = {}
if has_access(user, 'staff', 'global'): if has_access(user, 'staff', 'global'):
# Show any courses that errored on load # Show any courses that encountered an error on load
staff_access = True staff_access = True
errored_courses = modulestore().get_errored_courses() errored_courses = modulestore().get_errored_courses()
......
...@@ -310,6 +310,9 @@ ENABLE_COMPREHENSIVE_THEMING = ENV_TOKENS.get('ENABLE_COMPREHENSIVE_THEMING', EN ...@@ -310,6 +310,9 @@ ENABLE_COMPREHENSIVE_THEMING = ENV_TOKENS.get('ENABLE_COMPREHENSIVE_THEMING', EN
MKTG_URL_LINK_MAP.update(ENV_TOKENS.get('MKTG_URL_LINK_MAP', {})) MKTG_URL_LINK_MAP.update(ENV_TOKENS.get('MKTG_URL_LINK_MAP', {}))
SUPPORT_SITE_LINK = ENV_TOKENS.get('SUPPORT_SITE_LINK', SUPPORT_SITE_LINK) SUPPORT_SITE_LINK = ENV_TOKENS.get('SUPPORT_SITE_LINK', SUPPORT_SITE_LINK)
ACTIVATION_EMAIL_SUPPORT_LINK = ENV_TOKENS.get(
'ACTIVATION_EMAIL_SUPPORT_LINK', SUPPORT_SITE_LINK # Intentional default.
)
# Mobile store URL overrides # Mobile store URL overrides
MOBILE_STORE_URLS = ENV_TOKENS.get('MOBILE_STORE_URLS', MOBILE_STORE_URLS) MOBILE_STORE_URLS = ENV_TOKENS.get('MOBILE_STORE_URLS', MOBILE_STORE_URLS)
......
...@@ -137,6 +137,7 @@ ...@@ -137,6 +137,7 @@
"SITE_NAME": "localhost:8003", "SITE_NAME": "localhost:8003",
"STATIC_URL_BASE": "/static/", "STATIC_URL_BASE": "/static/",
"SUPPORT_SITE_LINK": "https://support.example.com", "SUPPORT_SITE_LINK": "https://support.example.com",
"ACTIVATION_EMAIL_SUPPORT_LINK": "https://support.example.com/activation-email-help.html",
"SYSLOG_SERVER": "", "SYSLOG_SERVER": "",
"TECH_SUPPORT_EMAIL": "technical@example.com", "TECH_SUPPORT_EMAIL": "technical@example.com",
"THIRD_PARTY_AUTH_BACKENDS": [ "THIRD_PARTY_AUTH_BACKENDS": [
......
...@@ -2268,6 +2268,7 @@ MKTG_URL_LINK_MAP = { ...@@ -2268,6 +2268,7 @@ MKTG_URL_LINK_MAP = {
STATIC_TEMPLATE_VIEW_DEFAULT_FILE_EXTENSION = 'html' STATIC_TEMPLATE_VIEW_DEFAULT_FILE_EXTENSION = 'html'
SUPPORT_SITE_LINK = '' SUPPORT_SITE_LINK = ''
ACTIVATION_EMAIL_SUPPORT_LINK = ''
############################# SOCIAL MEDIA SHARING ############################# ############################# SOCIAL MEDIA SHARING #############################
# Social Media Sharing on Student Dashboard # Social Media Sharing on Student Dashboard
......
...@@ -361,6 +361,7 @@ MKTG_URL_LINK_MAP = { ...@@ -361,6 +361,7 @@ MKTG_URL_LINK_MAP = {
} }
SUPPORT_SITE_LINK = 'https://support.example.com' SUPPORT_SITE_LINK = 'https://support.example.com'
ACTIVATION_EMAIL_SUPPORT_LINK = 'https://support.example.com/activation-email-help.html'
############################ STATIC FILES ############################# ############################ STATIC FILES #############################
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
......
<%page expression_filter="h"/> <%page expression_filter="h"/>
<%! <%!
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangolib.markup import HTML, Text from openedx.core.djangolib.markup import HTML, Text
%> %>
<div class="profile-sidebar" role="region" aria-labelledby="account-activation-title"> <div class="profile-sidebar" role="region" aria-labelledby="account-activation-title">
...@@ -20,11 +19,12 @@ from openedx.core.djangolib.markup import HTML, Text ...@@ -20,11 +19,12 @@ from openedx.core.djangolib.markup import HTML, Text
"Check your {email_start}{email}{email_end} inbox for an account activation link from {platform_name}. " "Check your {email_start}{email}{email_end} inbox for an account activation link from {platform_name}. "
"If you need help, contact {link_start}{platform_name} Support{link_end}." "If you need help, contact {link_start}{platform_name} Support{link_end}."
)).format( )).format(
platform_name=platform_name,
email_start=HTML("<strong>"), email_start=HTML("<strong>"),
email_end=HTML("</strong>"), email_end=HTML("</strong>"),
email=email, email=email,
platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), activation_email_support_link=activation_email_support_link,
link_start=HTML("<a target='_blank' href='https://support.edx.org/hc/en-us/articles/227340127-Why-haven-t-I-received-my-activation-email-'>"), link_start=HTML("<a target='_blank' href='${activation_email_support_link}'>"),
link_end=HTML("</a>"), link_end=HTML("</a>"),
)} )}
</p> </p>
......
...@@ -16,7 +16,8 @@ from openedx.core.djangolib.markup import HTML, Text ...@@ -16,7 +16,8 @@ from openedx.core.djangolib.markup import HTML, Text
"instructions for activating your account. If " "instructions for activating your account. If "
"you don't receive this message, check your " "you don't receive this message, check your "
"spam folder." "spam folder."
)).format(email_start=HTML("<strong>"), )).format(
email_start=HTML("<strong>"),
email_end=HTML("</strong>"), email_end=HTML("</strong>"),
email=email, email=email,
)} )}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment