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

@@ -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)