Skip to content

Commit 4a0d77a

Browse files
mariajgrimaldifarhaanbukhsh
authored andcommitted
fix: redirect to account MFE when using any legacy account URL (openedx#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.
1 parent 413e58f commit 4a0d77a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

openedx/core/djangoapps/user_api/legacy_urls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
"""
22
Defines the URL routes for this app.
33
"""
4+
from django.conf import settings
45
from django.urls import path, re_path, include
6+
from django.views.generic import RedirectView
57
from rest_framework import routers
68

79
from . import views as user_api_views
@@ -12,6 +14,10 @@
1214
USER_API_ROUTER.register(r'user_prefs', user_api_views.UserPreferenceViewSet)
1315

1416
urlpatterns = [
17+
# This redirect is needed for backward compatibility with the old URL structure for the authentication
18+
# workflows using third-party authentication providers until the authentication workflows fully support
19+
# the URL structure with MFEs.
20+
re_path(r'^account(?:/settings)?/?$', RedirectView.as_view(url=settings.ACCOUNT_MICROFRONTEND_URL)),
1521
path('user_api/v1/', include(USER_API_ROUTER.urls)),
1622
re_path(
1723
fr'^user_api/v1/preferences/(?P<pref_key>{UserPreference.KEY_REGEX})/users/$',

0 commit comments

Comments
 (0)