fix: redirection issue with enterprise selection page flow (#32909)

VAN-1511
This commit is contained in:
Syed Sajjad Hussain Shah
2023-08-07 10:09:55 +05:00
committed by GitHub
parent 58f44a8176
commit 7f06e72f5e
2 changed files with 5 additions and 1 deletions

View File

@@ -469,7 +469,7 @@ def enterprise_selection_page(request, user, next_url):
response = get_enterprise_learner_data_from_api(user)
if response and len(response) > 1:
redirect_url = reverse('enterprise_select_active') + '/?success_url=' + next_url
redirect_url = reverse('enterprise_select_active') + '/?success_url=' + urllib.parse.quote(next_url)
# Check to see if next url has an enterprise in it. In this case if user is associated with
# that enterprise, activate that enterprise and bypass the selection page.

View File

@@ -7,6 +7,7 @@ import datetime
import hashlib
import json
import unicodedata
import urllib.parse
from unittest.mock import Mock, patch
import ddt
@@ -312,6 +313,9 @@ class LoginTest(SiteMixin, CacheIsolationTestCase, OpenEdxEventsTestMixin):
HTTP_ACCEPT='*/*',
)
if not is_activated:
next_url = urllib.parse.quote(next_url)
self._assert_response(response, success=True)
self._assert_redirect_url(response, settings.LMS_ROOT_URL + expected_redirect + next_url)