Logistration MFE renamed to authn

VAN-300
This commit is contained in:
adeelehsan
2021-01-19 00:39:24 +05:00
parent 27defaba2f
commit 55d2a4f897
20 changed files with 55 additions and 55 deletions

View File

@@ -22,7 +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_authn.utils import should_redirect_to_authn_microfrontend
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference
from common.djangoapps.student.message_types import AccountRecovery as AccountRecoveryMessage
from common.djangoapps.student.models import CourseEnrollmentAllowed, email_exists_or_retired
@@ -39,7 +39,7 @@ 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() \
site_name = settings.AUTHN_MICROFRONTEND_DOMAIN if should_redirect_to_authn_microfrontend() \
else configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
message_context.update({
'request': request, # Used by google_analytics_tracking_pixel

View File

@@ -16,7 +16,7 @@ from common.djangoapps.student.tests.factories import UserFactory
FEATURES_WITH_LOGIN_MFE_ENABLED = settings.FEATURES.copy()
FEATURES_WITH_LOGIN_MFE_ENABLED['ENABLE_LOGISTRATION_MICROFRONTEND'] = True
FEATURES_WITH_LOGIN_MFE_ENABLED['ENABLE_AUTHN_MICROFRONTEND'] = True
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
@@ -158,7 +158,7 @@ class TestActivateAccount(TestCase):
login page with correct query param.
"""
login_page_url = "{authn_mfe}/login?account_activation_status=".format(
authn_mfe=settings.LOGISTRATION_MICROFRONTEND_URL
authn_mfe=settings.AUTHN_MICROFRONTEND_URL
)
self._assert_user_active_state(expected_active_state=False)

View File

@@ -50,7 +50,7 @@ from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.theming import helpers as theming_helpers
from openedx.core.djangoapps.user_api.preferences import api as preferences_api
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistration_mircrofrontend
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_authn_microfrontend
from openedx.core.djangolib.markup import HTML, Text
from common.djangoapps.student.helpers import DISABLE_UNENROLL_CERT_STATES, cert_info, generate_activation_email_context
from common.djangoapps.student.message_types import AccountActivation, EmailChange, EmailChangeConfirmation, RecoveryEmailCreate
@@ -547,9 +547,9 @@ def activate_account(request, key):
extra_tags='account-activation aa-icon',
)
if should_redirect_to_logistration_mircrofrontend() and not request.user.is_authenticated:
if should_redirect_to_authn_microfrontend() and not request.user.is_authenticated:
url_path = '/login?account_activation_status={}'.format(activation_message_type)
return redirect(settings.LOGISTRATION_MICROFRONTEND_URL + url_path)
return redirect(settings.AUTHN_MICROFRONTEND_URL + url_path)
return redirect('dashboard')

View File

@@ -88,7 +88,7 @@ from lms.djangoapps.verify_student.utils import earliest_allowed_verification_da
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.user_api import accounts
from openedx.core.djangoapps.user_authn import cookies as user_authn_cookies
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistration_mircrofrontend
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_authn_microfrontend
from common.djangoapps.third_party_auth.utils import user_exists
from common.djangoapps.track import segment
from common.djangoapps.util.json_request import JsonResponse
@@ -129,8 +129,8 @@ AUTH_ENTRY_REGISTER_API = 'register_api'
# registration/login form/logic.
AUTH_ENTRY_CUSTOM = getattr(settings, 'THIRD_PARTY_AUTH_CUSTOM_AUTH_FORMS', {})
# If logistration MFE is enabled, the redirect should be to MFE instead of FE
BASE_URL = settings.LOGISTRATION_MICROFRONTEND_URL if should_redirect_to_logistration_mircrofrontend() else ''
# If authn MFE is enabled, the redirect should be to MFE instead of FE
BASE_URL = settings.AUTHN_MICROFRONTEND_URL if should_redirect_to_authn_microfrontend() else ''
def is_api(auth_entry):

View File

@@ -643,7 +643,7 @@ FEATURES = {
# rollout.
'ENABLE_COURSEWARE_MICROFRONTEND': False,
# .. toggle_name: FEATURES['ENABLE_LOGISTRATION_MICROFRONTEND']
# .. toggle_name: FEATURES['ENABLE_AUTHN_MICROFRONTEND']
# .. toggle_implementation: DjangoSetting
# .. toggle_default: False
# .. toggle_description: Supports staged rollout of a new micro-frontend-based implementation of the logistration.
@@ -651,9 +651,9 @@ FEATURES = {
# .. toggle_creation_date: 2020-09-08
# .. toggle_target_removal_date: None
# .. toggle_tickets: 'https://github.com/edx/edx-platform/pull/24908'
# .. toggle_warnings: Also set settings.LOGISTRATION_MICROFRONTEND_URL for rollout. This temporary feature
# .. toggle_warnings: Also set settings.AUTHN_MICROFRONTEND_URL for rollout. This temporary feature
# toggle does not have a target removal date.
'ENABLE_LOGISTRATION_MICROFRONTEND': False,
'ENABLE_AUTHN_MICROFRONTEND': False,
### ORA Feature Flags ###
# .. toggle_name: FEATURES['ENABLE_ORA_ALL_FILE_URLS']
@@ -4090,8 +4090,8 @@ WRITABLE_GRADEBOOK_URL = None
PROFILE_MICROFRONTEND_URL = None
ORDER_HISTORY_MICROFRONTEND_URL = None
ACCOUNT_MICROFRONTEND_URL = None
LOGISTRATION_MICROFRONTEND_URL = None
LOGISTRATION_MICROFRONTEND_DOMAIN = None
AUTHN_MICROFRONTEND_URL = None
AUTHN_MICROFRONTEND_DOMAIN = None
PROGRAM_CONSOLE_MICROFRONTEND_URL = None
LEARNING_MICROFRONTEND_URL = None

View File

@@ -331,8 +331,8 @@ EDXNOTES_CLIENT_NAME = 'edx_notes_api-backend-service'
############## Settings for Microfrontends #########################
LEARNING_MICROFRONTEND_URL = 'http://localhost:2000'
ACCOUNT_MICROFRONTEND_URL = 'http://localhost:1997'
LOGISTRATION_MICROFRONTEND_URL = 'http://localhost:1999'
LOGISTRATION_MICROFRONTEND_DOMAIN = 'localhost:1999'
AUTHN_MICROFRONTEND_URL = 'http://localhost:1999'
AUTHN_MICROFRONTEND_DOMAIN = 'localhost:1999'
############## Docker based devstack settings #######################

View File

@@ -269,7 +269,7 @@ EDXNOTES_CLIENT_NAME = 'edx_notes_api-backend-service'
############## Settings for Microfrontends #########################
LEARNING_MICROFRONTEND_URL = 'http://localhost:2000'
ACCOUNT_MICROFRONTEND_URL = 'http://localhost:1997'
LOGISTRATION_MICROFRONTEND_URL = 'http://localhost:1999'
AUTHN_MICROFRONTEND_URL = 'http://localhost:1999'
############## Docker based devstack settings #######################

View File

@@ -569,8 +569,8 @@ PDF_RECEIPT_TAX_ID_LABEL = 'Tax ID'
PROFILE_MICROFRONTEND_URL = "http://profile-mfe/abc/"
ORDER_HISTORY_MICROFRONTEND_URL = "http://order-history-mfe/"
ACCOUNT_MICROFRONTEND_URL = "http://account-mfe"
LOGISTRATION_MICROFRONTEND_URL = "http://logistation-mfe"
LOGISTRATION_MICROFRONTEND_DOMAIN = "logistation-mfe"
AUTHN_MICROFRONTEND_URL = "http://authn-mfe"
AUTHN_MICROFRONTEND_DOMAIN = "authn-mfe"
LEARNING_MICROFRONTEND_URL = "http://learning-mfe"
########################## limiting dashboard courses ######################

View File

@@ -11,7 +11,7 @@ from django.urls import reverse
from django.utils.translation import ugettext as _
from six import text_type
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistration_mircrofrontend
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_authn_microfrontend
%>
<%
@@ -20,7 +20,7 @@ from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistra
allows_login = not settings.FEATURES['DISABLE_LOGIN_BUTTON'] and not combined_login_and_register
can_discover_courses = settings.FEATURES.get('ENABLE_COURSE_DISCOVERY')
allow_public_account_creation = static.get_value('ALLOW_PUBLIC_ACCOUNT_CREATION', settings.FEATURES.get('ALLOW_PUBLIC_ACCOUNT_CREATION'))
should_redirect_to_logistration_mfe = should_redirect_to_logistration_mircrofrontend()
should_redirect_to_authn_mfe = should_redirect_to_authn_microfrontend()
%>
<nav class="nav-links" aria-label=${_("Supplemental Links")}>
<div class="main">
@@ -49,9 +49,9 @@ from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistra
<div>
% if allows_login:
% if allow_public_account_creation:
% if should_redirect_to_logistration_mfe:
% if should_redirect_to_authn_mfe:
<div class="mobile-nav-item hidden-mobile nav-item">
<a class="register-btn btn" href="${settings.LOGISTRATION_MICROFRONTEND_URL}/register${login_query()}">${_("Register")}</a>
<a class="register-btn btn" href="${settings.AUTHN_MICROFRONTEND_URL}/register${login_query()}">${_("Register")}</a>
</div>
% else:
<div class="mobile-nav-item hidden-mobile nav-item">
@@ -59,9 +59,9 @@ from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistra
</div>
% endif
% endif
% if should_redirect_to_logistration_mfe:
% if should_redirect_to_authn_mfe:
<div class="mobile-nav-item hidden-mobile nav-item">
<a class="sign-in-btn btn" href="${settings.LOGISTRATION_MICROFRONTEND_URL}/login${login_query()}">${_("Sign in")}</a>
<a class="sign-in-btn btn" href="${settings.AUTHN_MICROFRONTEND_URL}/login${login_query()}">${_("Sign in")}</a>
</div>
% else:
<div class="mobile-nav-item hidden-mobile nav-item">

View File

@@ -1,5 +1,5 @@
"""
Logistration API urls
Authn API urls
"""
from django.conf.urls import url

View File

@@ -1,5 +1,5 @@
"""
Logistration API Views
Authn API Views
"""
from django.conf import settings

View File

@@ -86,7 +86,7 @@ urlpatterns = [
),
url(r'^account/password$', password_reset.password_change_request_handler, name='password_change_request'),
# logistration MFE flow
# authn MFE flow
url(
r'^api/user/v1/account/password_reset/token/validate/$',
password_reset.PasswordResetTokenValidation.as_view(),
@@ -96,7 +96,7 @@ urlpatterns = [
url(r'^user_api/v1/account/password_reset/token/validate/$', password_reset.PasswordResetTokenValidation.as_view(),
name="user_api_password_reset_token_validate_legacy"),
# logistration MFE reset flow
# authn MFE reset flow
url(
r'^password/reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
password_reset.LogistrationPasswordResetView.as_view(),

View File

@@ -70,10 +70,10 @@ def is_registration_api_v1(request):
return 'v1' in request.get_full_path() and 'register' not in request.get_full_path()
def should_redirect_to_logistration_mircrofrontend():
def should_redirect_to_authn_microfrontend():
"""
Checks if login/registration should be done via MFE.
"""
return configuration_helpers.get_value(
'ENABLE_LOGISTRATION_MICROFRONTEND', settings.FEATURES.get('ENABLE_LOGISTRATION_MICROFRONTEND')
'ENABLE_AUTHN_MICROFRONTEND', settings.FEATURES.get('ENABLE_AUTHN_MICROFRONTEND')
)

View File

@@ -33,7 +33,7 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_
from openedx.core.djangoapps.user_authn.views.login_form import get_login_session_form
from openedx.core.djangoapps.user_authn.cookies import get_response_with_refreshed_jwt_cookies, set_logged_in_cookies
from openedx.core.djangoapps.user_authn.exceptions import AuthFailedError
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistration_mircrofrontend
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_authn_microfrontend
from openedx.core.djangoapps.util.user_messages import PageLevelMessages
from openedx.core.djangoapps.user_authn.views.password_reset import send_password_reset_email_for_user
from openedx.core.djangoapps.user_authn.toggles import is_require_third_party_auth_enabled
@@ -125,7 +125,7 @@ def _generate_locked_out_error_message():
"""
locked_out_period_in_sec = settings.MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS
if not should_redirect_to_logistration_mircrofrontend: # pylint: disable=no-else-raise
if not should_redirect_to_authn_microfrontend: # pylint: disable=no-else-raise
raise AuthFailedError(Text(_('To protect your account, its been temporarily '
'locked. Try again in {locked_out_period} minutes.'
'{li_start}To be on the safe side, you can reset your '
@@ -238,7 +238,7 @@ def _handle_failed_authentication(user, authenticated_user):
if not LoginFailures.is_user_locked_out(user):
max_failures_allowed = settings.MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED
remaining_attempts = max_failures_allowed - failure_count
if not should_redirect_to_logistration_mircrofrontend: # pylint: disable=no-else-raise
if not should_redirect_to_authn_microfrontend: # pylint: disable=no-else-raise
raise AuthFailedError(Text(_('Email or password is incorrect.'
'{li_start}You have {remaining_attempts} more sign-in '
'attempts before your account is temporarily locked.{li_end}'
@@ -363,7 +363,7 @@ def _check_user_auth_flow(site, user):
# If user belongs to allowed domain and not whitelisted then user must login through allowed domain SSO
if user_domain == allowed_domain and not AllowedAuthUser.objects.filter(site=site, email=user.email).exists():
if not should_redirect_to_logistration_mircrofrontend():
if not should_redirect_to_authn_microfrontend():
msg = _create_message(site, None, allowed_domain)
else:
root_url = configuration_helpers.get_value('LMS_ROOT_URL', settings.LMS_ROOT_URL)
@@ -501,7 +501,7 @@ def login_user(request):
running_pipeline = pipeline.get(request)
redirect_url = pipeline.get_complete_url(backend_name=running_pipeline['backend'])
elif should_redirect_to_logistration_mircrofrontend():
elif should_redirect_to_authn_microfrontend():
redirect_url = get_next_url_for_login_page(request, include_host=True)
response = JsonResponse({

View File

@@ -24,7 +24,7 @@ from openedx.core.djangoapps.user_api.accounts.utils import (
)
from openedx.core.djangoapps.user_api.helpers import FormDescription
from openedx.core.djangoapps.user_authn.cookies import are_logged_in_cookies_set
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistration_mircrofrontend
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_authn_microfrontend
from openedx.core.djangoapps.user_authn.views.password_reset import get_password_reset_form
from openedx.core.djangoapps.user_authn.views.registration_form import RegistrationFormFactory
from openedx.core.djangoapps.user_authn.views.utils import third_party_auth_context
@@ -185,14 +185,14 @@ def login_and_registration_form(request, initial_mode="login"):
log.exception(u"Unknown tpa_hint provider: %s", ex)
enterprise_customer = enterprise_customer_for_request(request)
# Redirect to logistration MFE if it is enabled
if should_redirect_to_logistration_mircrofrontend() and not enterprise_customer:
# Redirect to authn MFE if it is enabled
if should_redirect_to_authn_microfrontend() and not enterprise_customer:
query_params = request.GET.urlencode()
url_path = '/{}{}'.format(
initial_mode,
'?' + query_params if query_params else ''
)
return redirect(settings.LOGISTRATION_MICROFRONTEND_URL + url_path)
return redirect(settings.AUTHN_MICROFRONTEND_URL + url_path)
# Account activation message
account_activation_messages = [

View File

@@ -35,7 +35,7 @@ from openedx.core.djangoapps.oauth_dispatch.api import destroy_oauth_tokens
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.theming.helpers import get_current_request, get_current_site
from openedx.core.djangoapps.user_api import accounts, errors, helpers
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistration_mircrofrontend
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_authn_microfrontend
from openedx.core.djangoapps.user_api.accounts.utils import is_secondary_email_feature_enabled
from openedx.core.djangoapps.user_api.helpers import FormDescription
from openedx.core.djangoapps.user_api.models import UserRetirementRequest
@@ -147,7 +147,7 @@ def send_password_reset_email_for_user(user, request, preferred_email=None):
preferred_email (str): Send email to this address if present, otherwise fallback to user's email address.
"""
message_context, user_language_preference = get_user_default_email_params(user)
site_name = settings.LOGISTRATION_MICROFRONTEND_DOMAIN if should_redirect_to_logistration_mircrofrontend() \
site_name = settings.AUTHN_MICROFRONTEND_DOMAIN if should_redirect_to_authn_microfrontend() \
else configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
message_context.update({
'request': request, # Used by google_analytics_tracking_pixel

View File

@@ -80,7 +80,7 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
self._assert_audit_log(mock_audit_log, 'info', [u'Login success', self.user_email])
FEATURES_WITH_LOGIN_MFE_ENABLED = settings.FEATURES.copy()
FEATURES_WITH_LOGIN_MFE_ENABLED['ENABLE_LOGISTRATION_MICROFRONTEND'] = True
FEATURES_WITH_LOGIN_MFE_ENABLED['ENABLE_AUTHN_MICROFRONTEND'] = True
@patch.dict(settings.FEATURES, {
"ENABLE_THIRD_PARTY_AUTH": True

View File

@@ -65,7 +65,7 @@ class LoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleSto
self.hidden_disabled_provider = self.configure_azure_ad_provider()
FEATURES_WITH_LOGIN_MFE_ENABLED = settings.FEATURES.copy()
FEATURES_WITH_LOGIN_MFE_ENABLED['ENABLE_LOGISTRATION_MICROFRONTEND'] = True
FEATURES_WITH_LOGIN_MFE_ENABLED['ENABLE_AUTHN_MICROFRONTEND'] = True
@ddt.data(
("signin_user", "/login"),
@@ -81,7 +81,7 @@ class LoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleSto
"""
response = self.client.get(reverse(url_name))
self.assertEqual(response.url, settings.LOGISTRATION_MICROFRONTEND_URL + path)
self.assertEqual(response.url, settings.AUTHN_MICROFRONTEND_URL + path)
self.assertEqual(response.status_code, 302)
@ddt.data(
@@ -103,7 +103,7 @@ class LoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleSto
Test that if request is redirected to logistration MFE,
query params are passed to the redirect url.
"""
expected_url = settings.LOGISTRATION_MICROFRONTEND_URL + path + '?' + urlencode(query_params)
expected_url = settings.AUTHN_MICROFRONTEND_URL + path + '?' + urlencode(query_params)
response = self.client.get(reverse(url_name), query_params)
self.assertRedirects(response, expected_url, target_status_code=302)

View File

@@ -46,8 +46,8 @@ from common.djangoapps.util.password_policy_validators import create_validator_c
from common.djangoapps.util.testing import EventTestMixin
ENABLE_LOGISTRATION_MICROFRONTEND = settings.FEATURES.copy()
ENABLE_LOGISTRATION_MICROFRONTEND['ENABLE_LOGISTRATION_MICROFRONTEND'] = True
ENABLE_AUTHN_MICROFRONTEND = settings.FEATURES.copy()
ENABLE_AUTHN_MICROFRONTEND['ENABLE_AUTHN_MICROFRONTEND'] = True
def process_request(request):
@@ -330,7 +330,7 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
SETTING_CHANGE_INITIATED, user_id=self.user.id, setting=u'password', old=None, new=None
)
@override_settings(FEATURES=ENABLE_LOGISTRATION_MICROFRONTEND)
@override_settings(FEATURES=ENABLE_AUTHN_MICROFRONTEND)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS")
@ddt.data(('Crazy Awesome Site', 'Crazy Awesome Site'), ('edX', 'edX'))
@ddt.unpack
@@ -354,7 +354,7 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
reset_msg = reset_msg.format(site_name)
self.assertIn(reset_msg, msg)
self.assertIn(settings.LOGISTRATION_MICROFRONTEND_URL, msg)
self.assertIn(settings.AUTHN_MICROFRONTEND_URL, msg)
sign_off = u"The {} Team".format(platform_name)
self.assertIn(sign_off, msg)

View File

@@ -21,9 +21,9 @@ from six import text_type
<div>
% if allows_login:
% if allow_public_account_creation:
% if should_redirect_to_logistration_mfe:
% if should_redirect_to_authn_mfe:
<div class="mobile-nav-item hidden-mobile nav-item">
<a class="register-btn btn" href="${settings.LOGISTRATION_MICROFRONTEND_URL}/register${login_query()}">${_("Register")}</a>
<a class="register-btn btn" href="${settings.AUTHN_MICROFRONTEND_URL}/register${login_query()}">${_("Register")}</a>
</div>
% else:
<div class="mobile-nav-item hidden-mobile nav-item">
@@ -31,9 +31,9 @@ from six import text_type
</div>
% endif
% endif
% if should_redirect_to_logistration_mfe:
% if should_redirect_to_authn_mfe:
<div class="mobile-nav-item hidden-mobile nav-item">
<a class="sign-in-btn btn" href="${settings.LOGISTRATION_MICROFRONTEND_URL}/login${login_query()}">${_("Sign in")}</a>
<a class="sign-in-btn btn" href="${settings.AUTHN_MICROFRONTEND_URL}/login${login_query()}">${_("Sign in")}</a>
</div>
% else:
<div class="mobile-nav-item hidden-mobile nav-item">