fix: redirect to account MFE when using any legacy account URL (#36894)
* fix: redirect to account MFE when using any legacy account URL Redirect to the account MFE URL configured each time a legacy account URL like http(s)://lms/account/ or http(s)://lms/account/settings is used to avoid 404 errors while linking SSO accounts or simply trying to access the account view via URLs.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
"""
|
||||
Defines the URL routes for this app.
|
||||
"""
|
||||
from django.conf import settings
|
||||
from django.urls import path, re_path, include
|
||||
from django.views.generic import RedirectView
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views as user_api_views
|
||||
@@ -12,6 +14,10 @@ USER_API_ROUTER.register(r'users', user_api_views.UserViewSet)
|
||||
USER_API_ROUTER.register(r'user_prefs', user_api_views.UserPreferenceViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
# This redirect is needed for backward compatibility with the old URL structure for the authentication
|
||||
# workflows using third-party authentication providers until the authentication workflows fully support
|
||||
# the URL structure with MFEs.
|
||||
re_path(r'^account(?:/settings)?/?$', RedirectView.as_view(url=settings.ACCOUNT_MICROFRONTEND_URL)),
|
||||
path('user_api/v1/', include(USER_API_ROUTER.urls)),
|
||||
re_path(
|
||||
fr'^user_api/v1/preferences/(?P<pref_key>{UserPreference.KEY_REGEX})/users/$',
|
||||
|
||||
Reference in New Issue
Block a user