From a5741e20d20ba46db5bccc56db9d94ac12ba73e2 Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Wed, 11 Jun 2025 13:04:01 +0200 Subject: [PATCH 1/2] 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. --- openedx/core/djangoapps/user_api/legacy_urls.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openedx/core/djangoapps/user_api/legacy_urls.py b/openedx/core/djangoapps/user_api/legacy_urls.py index ad02f7f19ce8..709e2e585adb 100644 --- a/openedx/core/djangoapps/user_api/legacy_urls.py +++ b/openedx/core/djangoapps/user_api/legacy_urls.py @@ -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,7 @@ USER_API_ROUTER.register(r'user_prefs', user_api_views.UserPreferenceViewSet) urlpatterns = [ + 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{UserPreference.KEY_REGEX})/users/$', From 8e6e32c457651fad0557a1368f2f00b7cdea862d Mon Sep 17 00:00:00 2001 From: Maria Grimaldi Date: Tue, 17 Jun 2025 11:16:36 +0200 Subject: [PATCH 2/2] docs: add comment explaining why redirect is needed --- openedx/core/djangoapps/user_api/legacy_urls.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openedx/core/djangoapps/user_api/legacy_urls.py b/openedx/core/djangoapps/user_api/legacy_urls.py index 709e2e585adb..3c8da9bd830a 100644 --- a/openedx/core/djangoapps/user_api/legacy_urls.py +++ b/openedx/core/djangoapps/user_api/legacy_urls.py @@ -14,6 +14,9 @@ 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(