Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
032f62e5
Commit
032f62e5
authored
Jun 22, 2017
by
Saleem Latif
Committed by
Tim Krones
Jun 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove enterprise cookie when it is not needed any further.
parent
b2663002
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
lms/djangoapps/student_account/test/test_views.py
+18
-1
lms/djangoapps/student_account/views.py
+9
-1
lms/envs/aws.py
+4
-1
lms/envs/common.py
+1
-0
No files found.
lms/djangoapps/student_account/test/test_views.py
View file @
032f62e5
...
...
@@ -31,7 +31,7 @@ from commerce.models import CommerceConfiguration
from
commerce.tests
import
factories
from
commerce.tests.mocks
import
mock_get_orders
from
course_modes.models
import
CourseMode
from
edxmako.shortcuts
import
render_to_respons
e
from
http.cookies
import
SimpleCooki
e
from
openedx.core.djangoapps.oauth_dispatch.tests
import
factories
as
dot_factories
from
openedx.core.djangoapps.programs.tests.mixins
import
ProgramsApiConfigMixin
from
openedx.core.djangoapps.site_configuration.tests.mixins
import
SiteMixin
...
...
@@ -542,6 +542,23 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
if
logo_url
:
self
.
assertContains
(
response
,
logo_url
)
def
test_enterprise_cookie_delete
(
self
):
"""
Test that enterprise cookies are deleted in login/registration views.
Cookies must be deleted in login/registration views so that *default* login/registration branding
is displayed to subsequent requests from non-enterprise customers.
"""
cookies
=
SimpleCookie
()
cookies
[
settings
.
ENTERPRISE_CUSTOMER_COOKIE_NAME
]
=
'test-enterprise-customer'
response
=
self
.
client
.
get
(
reverse
(
'signin_user'
),
HTTP_ACCEPT
=
"text/html"
,
cookies
=
cookies
)
self
.
assertIn
(
settings
.
ENTERPRISE_CUSTOMER_COOKIE_NAME
,
response
.
cookies
)
# pylint:disable=no-member
enterprise_cookie
=
response
.
cookies
[
settings
.
ENTERPRISE_CUSTOMER_COOKIE_NAME
]
# pylint:disable=no-member
self
.
assertEqual
(
enterprise_cookie
[
'domain'
],
settings
.
BASE_COOKIE_DOMAIN
)
self
.
assertEqual
(
enterprise_cookie
.
value
,
''
)
@override_settings
(
SITE_NAME
=
settings
.
MICROSITE_TEST_HOSTNAME
)
def
test_microsite_uses_old_login_page
(
self
):
# Retrieve the login page from a microsite domain
...
...
lms/djangoapps/student_account/views.py
View file @
032f62e5
...
...
@@ -150,7 +150,15 @@ def login_and_registration_form(request, initial_mode="login"):
context
=
update_context_for_enterprise
(
request
,
context
)
return
render_to_response
(
'student_account/login_and_register.html'
,
context
)
response
=
render_to_response
(
'student_account/login_and_register.html'
,
context
)
# Remove enterprise cookie so that subsequent requests show default login page.
response
.
delete_cookie
(
configuration_helpers
.
get_value
(
"ENTERPRISE_CUSTOMER_COOKIE_NAME"
,
settings
.
ENTERPRISE_CUSTOMER_COOKIE_NAME
),
domain
=
configuration_helpers
.
get_value
(
"BASE_COOKIE_DOMAIN"
,
settings
.
BASE_COOKIE_DOMAIN
),
)
return
response
@require_http_methods
([
'POST'
])
...
...
lms/envs/aws.py
View file @
032f62e5
...
...
@@ -953,7 +953,6 @@ ENTERPRISE_COURSE_ENROLLMENT_AUDIT_MODES = ENV_TOKENS.get(
ENTERPRISE_COURSE_ENROLLMENT_AUDIT_MODES
)
############## ENTERPRISE SERVICE API CLIENT CONFIGURATION ######################
# The LMS communicates with the Enterprise service via the EdxRestApiClient class
# The below environmental settings are utilized by the LMS when interacting with
...
...
@@ -992,6 +991,10 @@ ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS = set(
ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS
)
)
BASE_COOKIE_DOMAIN
=
ENV_TOKENS
.
get
(
'BASE_COOKIE_DOMAIN'
,
BASE_COOKIE_DOMAIN
)
############## CATALOG/DISCOVERY SERVICE API CLIENT CONFIGURATION ######################
# The LMS communicates with the Catalog service via the EdxRestApiClient class
...
...
lms/envs/common.py
View file @
032f62e5
...
...
@@ -3177,6 +3177,7 @@ ENTERPRISE_EXCLUDED_REGISTRATION_FIELDS = {
'mailing_address'
,
}
ENTERPRISE_CUSTOMER_COOKIE_NAME
=
'enterprise_customer_uuid'
BASE_COOKIE_DOMAIN
=
'localhost'
############## Settings for Course Enrollment Modes ######################
COURSE_ENROLLMENT_MODES
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment