Check and update login status with all login-related cookies
This commit is contained in:
@@ -175,7 +175,8 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin,
|
||||
MOCK_SETTINGS = {
|
||||
'FEATURES': {
|
||||
'DISABLE_START_DATES': False,
|
||||
'ENABLE_MKTG_SITE': True
|
||||
'ENABLE_MKTG_SITE': True,
|
||||
'DISABLE_SET_JWT_COOKIES_FOR_TESTS': True,
|
||||
},
|
||||
'SOCIAL_SHARING_SETTINGS': {
|
||||
'CUSTOM_COURSE_URLS': True,
|
||||
@@ -186,6 +187,7 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin,
|
||||
MOCK_SETTINGS_HIDE_COURSES = {
|
||||
'FEATURES': {
|
||||
'HIDE_DASHBOARD_COURSES_UNTIL_ACTIVATED': True,
|
||||
'DISABLE_SET_JWT_COOKIES_FOR_TESTS': True,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ from openedx.features.enterprise_support.api import get_dashboard_consent_notifi
|
||||
from openedx.features.journals.api import journals_enabled
|
||||
from shoppingcart.api import order_history
|
||||
from shoppingcart.models import CourseRegistrationCode, DonationConfiguration
|
||||
from openedx.core.djangoapps.user_authn.cookies import set_deprecated_user_info_cookie
|
||||
from openedx.core.djangoapps.user_authn.cookies import set_logged_in_cookies
|
||||
from student.helpers import cert_info, check_verify_status_by_course
|
||||
from student.models import (
|
||||
CourseEnrollment,
|
||||
@@ -851,5 +851,5 @@ def student_dashboard(request):
|
||||
})
|
||||
|
||||
response = render_to_response('dashboard.html', context)
|
||||
set_deprecated_user_info_cookie(response, request, user) # pylint: disable=protected-access
|
||||
set_logged_in_cookies(request, response, user)
|
||||
return response
|
||||
|
||||
@@ -632,7 +632,7 @@ def set_logged_in_cookies(backend=None, user=None, strategy=None, auth_entry=Non
|
||||
# Check that the cookie isn't already set.
|
||||
# This ensures that we allow the user to continue to the next
|
||||
# pipeline step once he/she has the cookie set by this step.
|
||||
has_cookie = user_authn_cookies.is_logged_in_cookie_set(request)
|
||||
has_cookie = user_authn_cookies.are_logged_in_cookies_set(request)
|
||||
if not has_cookie:
|
||||
try:
|
||||
redirect_url = get_complete_url(current_partial.backend)
|
||||
|
||||
Reference in New Issue
Block a user