Update logistration MFE feature flag (#25356)
update logistration MFE feature flag to not be used in conjunction with Accounts MFE toggle. VAN-11
This commit is contained in:
@@ -601,8 +601,8 @@ 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.ACCOUNT_MICROFRONTEND_URL and set REDIRECT_TO_ACCOUNT_MICROFRONTEND for
|
||||
# rollout. This temporary feature toggle does not have a target removal date.
|
||||
# .. toggle_warnings: Also set settings.LOGISTRATION_MICROFRONTEND_URL for rollout. This temporary feature
|
||||
# toggle does not have a target removal date.
|
||||
'ENABLE_LOGISTRATION_MICROFRONTEND': False,
|
||||
|
||||
### ORA Feature Flags ###
|
||||
@@ -4000,6 +4000,7 @@ WRITABLE_GRADEBOOK_URL = None
|
||||
PROFILE_MICROFRONTEND_URL = None
|
||||
ORDER_HISTORY_MICROFRONTEND_URL = None
|
||||
ACCOUNT_MICROFRONTEND_URL = None
|
||||
LOGISTRATION_MICROFRONTEND_URL = None
|
||||
PROGRAM_CONSOLE_MICROFRONTEND_URL = None
|
||||
LEARNING_MICROFRONTEND_URL = None
|
||||
|
||||
|
||||
@@ -331,6 +331,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'
|
||||
|
||||
############## Docker based devstack settings #######################
|
||||
|
||||
|
||||
@@ -270,6 +270,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'
|
||||
|
||||
############## Docker based devstack settings #######################
|
||||
|
||||
|
||||
@@ -571,6 +571,7 @@ 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"
|
||||
LEARNING_MICROFRONTEND_URL = "http://learning-mfe"
|
||||
|
||||
########################## limiting dashboard courses ######################
|
||||
|
||||
@@ -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_api.accounts.toggles import should_redirect_to_logistration_mircrofrontend
|
||||
from openedx.core.djangoapps.user_authn.utils import should_redirect_to_logistration_mircrofrontend
|
||||
%>
|
||||
|
||||
<%
|
||||
@@ -51,7 +51,7 @@ from openedx.core.djangoapps.user_api.accounts.toggles import should_redirect_to
|
||||
% if allow_public_account_creation:
|
||||
% if should_redirect_to_logistration_mfe:
|
||||
<div class="mobile-nav-item hidden-mobile nav-item">
|
||||
<a class="register-btn btn" href="${settings.ACCOUNT_MICROFRONTEND_URL}/register${login_query()}">${_("Register")}</a>
|
||||
<a class="register-btn btn" href="${settings.LOGISTRATION_MICROFRONTEND_URL}/register${login_query()}">${_("Register")}</a>
|
||||
</div>
|
||||
% else:
|
||||
<div class="mobile-nav-item hidden-mobile nav-item">
|
||||
@@ -61,7 +61,7 @@ from openedx.core.djangoapps.user_api.accounts.toggles import should_redirect_to
|
||||
% endif
|
||||
% if should_redirect_to_logistration_mfe:
|
||||
<div class="mobile-nav-item hidden-mobile nav-item">
|
||||
<a class="sign-in-btn btn" href="${settings.ACCOUNT_MICROFRONTEND_URL}/login${login_query()}">${_("Sign in")}</a>
|
||||
<a class="sign-in-btn btn" href="${settings.LOGISTRATION_MICROFRONTEND_URL}/login${login_query()}">${_("Sign in")}</a>
|
||||
</div>
|
||||
% else:
|
||||
<div class="mobile-nav-item hidden-mobile nav-item">
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
Toggles for accounts related code.
|
||||
"""
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.waffle_utils import WaffleFlag
|
||||
|
||||
@@ -44,10 +42,3 @@ def should_redirect_to_account_microfrontend():
|
||||
configuration_helpers.get_value('ENABLE_ACCOUNT_MICROFRONTEND') and
|
||||
REDIRECT_TO_ACCOUNT_MICROFRONTEND.is_enabled()
|
||||
)
|
||||
|
||||
|
||||
def should_redirect_to_logistration_mircrofrontend():
|
||||
return (
|
||||
should_redirect_to_account_microfrontend() and
|
||||
settings.FEATURES.get('ENABLE_LOGISTRATION_MICROFRONTEND')
|
||||
)
|
||||
|
||||
@@ -11,6 +11,8 @@ from django.utils import http
|
||||
from oauth2_provider.models import Application
|
||||
from six.moves.urllib.parse import urlparse # pylint: disable=import-error
|
||||
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
|
||||
|
||||
def is_safe_login_or_logout_redirect(redirect_to, request_host, dot_client_id, require_https):
|
||||
"""
|
||||
@@ -67,3 +69,12 @@ def is_registration_api_v1(request):
|
||||
:return: Bool
|
||||
"""
|
||||
return 'v1' in request.get_full_path() and 'register' not in request.get_full_path()
|
||||
|
||||
|
||||
def should_redirect_to_logistration_mircrofrontend():
|
||||
"""
|
||||
Checks if login/registration should be done via MFE.
|
||||
"""
|
||||
return configuration_helpers.get_value(
|
||||
'ENABLE_LOGISTRATION_MICROFRONTEND', settings.FEATURES.get('ENABLE_LOGISTRATION_MICROFRONTEND')
|
||||
)
|
||||
|
||||
@@ -31,10 +31,10 @@ from rest_framework.views import APIView
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from openedx.core.djangoapps.password_policy import compliance as password_policy_compliance
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_api.accounts.toggles import should_redirect_to_logistration_mircrofrontend
|
||||
from openedx.core.djangoapps.user_authn.views.login_form import get_login_session_form
|
||||
from openedx.core.djangoapps.user_authn.cookies import refresh_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.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.config.waffle import ENABLE_LOGIN_USING_THIRDPARTY_AUTH_ONLY
|
||||
|
||||
@@ -18,13 +18,13 @@ import third_party_auth
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.core.djangoapps.user_api import accounts
|
||||
from openedx.core.djangoapps.user_api.accounts.toggles import should_redirect_to_logistration_mircrofrontend
|
||||
from openedx.core.djangoapps.user_api.accounts.utils import (
|
||||
is_multiple_user_enterprises_feature_enabled,
|
||||
is_secondary_email_feature_enabled
|
||||
)
|
||||
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.views.password_reset import get_password_reset_form
|
||||
from openedx.core.djangoapps.user_authn.views.registration_form import RegistrationFormFactory
|
||||
from openedx.features.enterprise_support.api import enterprise_customer_for_request
|
||||
@@ -189,7 +189,7 @@ def login_and_registration_form(request, initial_mode="login"):
|
||||
initial_mode,
|
||||
'?' + query_params if query_params else ''
|
||||
)
|
||||
return redirect(settings.ACCOUNT_MICROFRONTEND_URL + url_path)
|
||||
return redirect(settings.LOGISTRATION_MICROFRONTEND_URL + url_path)
|
||||
|
||||
# Account activation message
|
||||
account_activation_messages = [
|
||||
|
||||
@@ -25,7 +25,6 @@ from openedx.core.djangoapps.password_policy.compliance import (
|
||||
NonCompliantPasswordWarning
|
||||
)
|
||||
from openedx.core.djangoapps.user_api.accounts import EMAIL_MIN_LENGTH, EMAIL_MAX_LENGTH
|
||||
from openedx.core.djangoapps.user_api.accounts.toggles import REDIRECT_TO_ACCOUNT_MICROFRONTEND
|
||||
from openedx.core.djangoapps.user_authn.cookies import jwt_cookies
|
||||
from openedx.core.djangoapps.user_authn.views.login import (
|
||||
AllowedAuthUser,
|
||||
@@ -35,7 +34,6 @@ from openedx.core.djangoapps.user_authn.views.login import (
|
||||
from openedx.core.djangoapps.user_authn.tests.utils import setup_login_oauth_client
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase, skip_unless_lms
|
||||
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
|
||||
from openedx.core.lib.api.test_utils import ApiTestCase
|
||||
from student.tests.factories import RegistrationFactory, UserFactory, UserProfileFactory
|
||||
from util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH
|
||||
@@ -142,8 +140,6 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
|
||||
@override_settings(FEATURES=FEATURES_WITH_LOGIN_MFE_ENABLED)
|
||||
@skip_unless_lms
|
||||
def test_login_success_with_redirect(self, next_url, course_id, expected_redirect):
|
||||
site_domain = 'example.org'
|
||||
self.set_up_site(site_domain, {'ENABLE_ACCOUNT_MICROFRONTEND': True})
|
||||
post_params = {}
|
||||
|
||||
if next_url:
|
||||
@@ -151,13 +147,12 @@ class LoginTest(SiteMixin, CacheIsolationTestCase):
|
||||
if course_id:
|
||||
post_params['course_id'] = course_id
|
||||
|
||||
with override_waffle_flag(REDIRECT_TO_ACCOUNT_MICROFRONTEND, active=True):
|
||||
response, _ = self._login_response(
|
||||
self.user_email,
|
||||
self.password,
|
||||
extra_post_params=post_params,
|
||||
HTTP_ACCEPT='*/*',
|
||||
)
|
||||
response, _ = self._login_response(
|
||||
self.user_email,
|
||||
self.password,
|
||||
extra_post_params=post_params,
|
||||
HTTP_ACCEPT='*/*',
|
||||
)
|
||||
self._assert_response(response, success=True)
|
||||
self._assert_redirect_url(response, expected_redirect)
|
||||
|
||||
|
||||
@@ -27,9 +27,7 @@ from lms.djangoapps.branding.api import get_privacy_url
|
||||
from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfigurationFactory, SiteFactory
|
||||
from openedx.core.djangoapps.site_configuration.tests.mixins import SiteMixin
|
||||
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme_context
|
||||
from openedx.core.djangoapps.user_api.accounts.toggles import REDIRECT_TO_ACCOUNT_MICROFRONTEND
|
||||
from openedx.core.djangoapps.user_authn.views.login_form import login_and_registration_form
|
||||
from openedx.core.djangoapps.waffle_utils.testutils import override_waffle_flag
|
||||
from openedx.core.djangolib.js_utils import dump_js_escaped_json
|
||||
from openedx.core.djangolib.markup import HTML, Text
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
@@ -40,7 +38,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
|
||||
@skip_unless_lms
|
||||
@ddt.ddt
|
||||
class LoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleStoreTestCase, SiteMixin):
|
||||
class LoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleStoreTestCase):
|
||||
""" Tests for Login and Registration. """
|
||||
USERNAME = "bob"
|
||||
EMAIL = "bob@example.com"
|
||||
@@ -82,13 +80,9 @@ class LoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleSto
|
||||
Test that if Logistration MFE is enabled, then we redirect to
|
||||
the correct URL.
|
||||
"""
|
||||
site_domain = 'example.org'
|
||||
self.set_up_site(site_domain, {'ENABLE_ACCOUNT_MICROFRONTEND': True})
|
||||
response = self.client.get(reverse(url_name))
|
||||
|
||||
with override_waffle_flag(REDIRECT_TO_ACCOUNT_MICROFRONTEND, active=True):
|
||||
response = self.client.get(reverse(url_name))
|
||||
|
||||
self.assertEqual(response.url, settings.ACCOUNT_MICROFRONTEND_URL + path)
|
||||
self.assertEqual(response.url, settings.LOGISTRATION_MICROFRONTEND_URL + path)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
@ddt.data(
|
||||
@@ -110,15 +104,10 @@ class LoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMixin, ModuleSto
|
||||
Test that if request is redirected to logistration MFE,
|
||||
query params are passed to the redirect url.
|
||||
"""
|
||||
site_domain = 'example.org'
|
||||
expected_url = settings.ACCOUNT_MICROFRONTEND_URL + path + '?' + urlencode(query_params)
|
||||
expected_url = settings.LOGISTRATION_MICROFRONTEND_URL + path + '?' + urlencode(query_params)
|
||||
response = self.client.get(reverse(url_name), query_params)
|
||||
|
||||
self.set_up_site(site_domain, {'ENABLE_ACCOUNT_MICROFRONTEND': True})
|
||||
|
||||
with override_waffle_flag(REDIRECT_TO_ACCOUNT_MICROFRONTEND, active=True):
|
||||
response = self.client.get(reverse(url_name), query_params)
|
||||
|
||||
self.assertRedirects(response, expected_url)
|
||||
self.assertRedirects(response, expected_url, target_status_code=302)
|
||||
|
||||
@ddt.data(
|
||||
("signin_user", "login"),
|
||||
|
||||
@@ -23,7 +23,7 @@ from six import text_type
|
||||
% if allow_public_account_creation:
|
||||
% if should_redirect_to_logistration_mfe:
|
||||
<div class="mobile-nav-item hidden-mobile nav-item">
|
||||
<a class="register-btn btn" href="${settings.ACCOUNT_MICROFRONTEND_URL}/register${login_query()}">${_("Register")}</a>
|
||||
<a class="register-btn btn" href="${settings.LOGISTRATION_MICROFRONTEND_URL}/register${login_query()}">${_("Register")}</a>
|
||||
</div>
|
||||
% else:
|
||||
<div class="mobile-nav-item hidden-mobile nav-item">
|
||||
@@ -33,7 +33,7 @@ from six import text_type
|
||||
% endif
|
||||
% if should_redirect_to_logistration_mfe:
|
||||
<div class="mobile-nav-item hidden-mobile nav-item">
|
||||
<a class="sign-in-btn btn" href="${settings.ACCOUNT_MICROFRONTEND_URL}/login${login_query()}">${_("Sign in")}</a>
|
||||
<a class="sign-in-btn btn" href="${settings.LOGISTRATION_MICROFRONTEND_URL}/login${login_query()}">${_("Sign in")}</a>
|
||||
</div>
|
||||
% else:
|
||||
<div class="mobile-nav-item hidden-mobile nav-item">
|
||||
|
||||
Reference in New Issue
Block a user