Adds Logistration MFE url for forgot password email.

This patch would enable routing learner to logistration MFE
via forgot password url than on platform when
ENABLE_LOGISTRATION_MICROFRONTEND feature flag is set.

VAN-98
This commit is contained in:
Adeel Khan
2020-10-29 15:03:24 +05:00
parent 7afee25ce2
commit d61936fdb6
6 changed files with 17 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_
from openedx.core.djangoapps.theming.helpers import get_current_site
from openedx.core.djangoapps.user_api import accounts as accounts_settings
from openedx.core.djangoapps.user_api.accounts.utils import is_secondary_email_feature_enabled
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistration_mircrofrontend
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference
from student.message_types import AccountRecovery as AccountRecoveryMessage
from student.models import CourseEnrollmentAllowed, email_exists_or_retired
@@ -38,13 +39,15 @@ def send_account_recovery_email_for_user(user, request, email=None):
"""
site = get_current_site()
message_context = get_base_template_context(site)
site_name = settings.LOGISTRATION_MICROFRONTEND_DOMAIN if should_redirect_to_logistration_mircrofrontend() \
else configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
message_context.update({
'request': request, # Used by google_analytics_tracking_pixel
'email': email,
'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'reset_link': '{protocol}://{site}{link}?is_account_recovery=true'.format(
protocol='https' if request.is_secure() else 'http',
site=configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME),
site=site_name,
link=reverse('password_reset_confirm', kwargs={
'uidb36': int_to_base36(user.id),
'token': default_token_generator.make_token(user),