Skip to content

Commit

Permalink
feat: proxy login now redirects to LMS register page instead of login…
Browse files Browse the repository at this point in the history
… page

Most learners hitting the proxy login view are net-new learners utilizing
an enterprise invite key, so they're better off starting on the register page.
ENT-9429
  • Loading branch information
iloveagent57 committed Oct 2, 2024
1 parent 83df46f commit 736eef1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Unreleased
----------
* nothing unreleased

[4.26.1]
---------
* feat: proxy login now redirects to LMS register page instead of login page

[4.26.0]
---------
* feat: add new field to EnterpriseGroup model and EnterpriseGroupSerializer
Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Your project description goes here.
"""

__version__ = "4.26.0"
__version__ = "4.26.1"
4 changes: 2 additions & 2 deletions enterprise/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
LMS_PROGRAMS_DASHBOARD_URL = urljoin(settings.LMS_ROOT_URL, '/dashboard/programs/{uuid}')
LMS_START_PREMIUM_COURSE_FLOW_URL = urljoin(settings.LMS_ROOT_URL, '/verify_student/start-flow/{course_id}/')
LMS_COURSEWARE_URL = urljoin(settings.LMS_ROOT_URL, '/courses/{course_id}/courseware')
LMS_LOGIN_URL = urljoin(settings.LMS_ROOT_URL, '/login')
LMS_REGISTER_URL = urljoin(settings.LMS_ROOT_URL, '/register')
ENTERPRISE_GENERAL_ERROR_PAGE = 'enterprise/enterprise_error_page_with_messages.html'

# Constants used for logging errors that occur during
Expand Down Expand Up @@ -1023,7 +1023,7 @@ def get(self, request):
"""
Redirects a learner through login with their enterprise's third party auth if it uses tpa.
"""
redirect_to = LMS_LOGIN_URL
redirect_to = LMS_REGISTER_URL
(scheme, netloc, path, query, fragment) = list(urlsplit(redirect_to))
query_dict = parse_qs(query)
query_params = request.GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from django.test import Client, TestCase
from django.urls import reverse

from enterprise.views import LMS_LOGIN_URL
from enterprise.views import LMS_REGISTER_URL
from test_utils.factories import (
EnterpriseCustomerFactory,
EnterpriseCustomerIdentityProviderFactory,
Expand Down Expand Up @@ -138,7 +138,7 @@ def test_slug_redirect_no_tpa(self, use_next, use_slug, use_invite_key):
learner_portal_url = settings.ENTERPRISE_LEARNER_PORTAL_BASE_URL
query_params['next'] = learner_portal_url + '/' + customer_without_tpa.slug
query_params['proxy_login'] = True
expected_url = LMS_LOGIN_URL + '?' + query_params.urlencode()
expected_url = LMS_REGISTER_URL + '?' + query_params.urlencode()
self.assertRedirects(response, expected_url, fetch_redirect_response=False)

@ddt.data(
Expand Down Expand Up @@ -181,7 +181,7 @@ def test_slug_tpa_redirect(self, use_next, use_slug, use_invite_key):
learner_portal_url = settings.ENTERPRISE_LEARNER_PORTAL_BASE_URL
next_url = learner_portal_url + '/' + self.enterprise_customer.slug
query_params['next'] = f'{next_url}?tpa_hint={self.enterprise_customer.identity_provider}'
expected_url = LMS_LOGIN_URL + '?' + query_params.urlencode()
expected_url = LMS_REGISTER_URL + '?' + query_params.urlencode()
self.assertRedirects(response, expected_url, fetch_redirect_response=False)

@ddt.data(
Expand Down Expand Up @@ -225,5 +225,5 @@ def test_tpa_redirects_using_tpa_hint_param(
query_params['enterprise_customer'] = str(enterprise_customer.uuid)
query_params['proxy_login'] = True
query_params['next'] = next_url
expected_url = f'{LMS_LOGIN_URL}?{query_params.urlencode()}'
expected_url = f'{LMS_REGISTER_URL}?{query_params.urlencode()}'
self.assertRedirects(response, expected_url, fetch_redirect_response=False)

0 comments on commit 736eef1

Please sign in to comment.