From 38671c88bd6132f4297a577b90093d46409d28c1 Mon Sep 17 00:00:00 2001 From: Arjun Singh Yadav Date: Wed, 31 Mar 2021 18:06:41 +0530 Subject: [PATCH 1/2] fix: redirect unauthenticated user to the login page on enroll (cherry picked from commit aee69cd5c42d1a23e3b3f70e363f50caeb2c772e) --- lms/templates/courseware/course_about.html | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index 3579e4886a3c..7e806a467de8 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -40,13 +40,8 @@ location.href = xhr.responseText; } } else if (xhr.status == 403) { - %if settings.REDIRECT_UNAUTHENTICATED_USER_TO_LOGIN_ON_ENROLL: - location.replace("${reverse('signin_user') | n, js_escaped_string}?next=${request.path | u}"); - %else: - $('#register_error').text( - (xhr.responseText ? xhr.responseText : "${_("An error has occurred. Please ensure that you are logged in to enroll.") | n, js_escaped_string}") - ).css("display", "block"); - %endif + // redirect unauthenticated user to the login page + location.replace("${reverse('signin_user') | n, js_escaped_string}?next=" + encodeURIComponent("${request.path | n, js_escaped_string}")); } else { $('#register_error').text( (xhr.responseText ? xhr.responseText : "${_("An error occurred. Please try again later.") | n, js_escaped_string}") From ac18ef7163b769bc8fa48eff6ddb5e3af7d8ba43 Mon Sep 17 00:00:00 2001 From: Shimul Chowdhury Date: Thu, 19 Aug 2021 22:43:27 +0800 Subject: [PATCH 2/2] chore: remove toggle --- lms/envs/common.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lms/envs/common.py b/lms/envs/common.py index 6708cf69e42e..77c4e63078bc 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -702,10 +702,6 @@ # e.g. COURSE_BLOCKS_API_EXTRA_FIELDS = [ ('course', 'other_course_settings'), ("problem", "weight") ] COURSE_BLOCKS_API_EXTRA_FIELDS = [] -# Setting to redirect unauthenticated users to the login page when enrolling from the course about -# page instead of showing an error message. After successful login redirects them back to the course about page. -REDIRECT_UNAUTHENTICATED_USER_TO_LOGIN_ON_ENROLL = False - # Settings for the course reviews tool template and identification key, set either to None to disable course reviews COURSE_REVIEWS_TOOL_PROVIDER_FRAGMENT_NAME = 'coursetalk-reviews-fragment.html' COURSE_REVIEWS_TOOL_PROVIDER_PLATFORM_KEY = 'edx'