Skip to content

Commit

Permalink
fix: redirection issue with enterprise selection page flow (openedx#3…
Browse files Browse the repository at this point in the history
…2909)

VAN-1511
  • Loading branch information
syedsajjadkazmii authored Aug 7, 2023
1 parent 58f44a8 commit 7f06e72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_authn/views/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions openedx/core/djangoapps/user_authn/views/tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import hashlib
import json
import unicodedata
import urllib.parse
from unittest.mock import Mock, patch

import ddt
Expand Down Expand Up @@ -312,6 +313,9 @@ def test_enterprise_in_url(
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)

Expand Down

0 comments on commit 7f06e72

Please sign in to comment.