Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
97fb51ce
Commit
97fb51ce
authored
4 years ago
by
Sharon Wang
Browse files
Options
Downloads
Patches
Plain Diff
sos
parent
d1549e51
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openedx/core/djangoapps/user_authn/cookies.py
+10
-0
10 additions, 0 deletions
openedx/core/djangoapps/user_authn/cookies.py
openedx/core/djangoapps/user_authn/tests/test_cookies.py
+1
-0
1 addition, 0 deletions
openedx/core/djangoapps/user_authn/tests/test_cookies.py
with
11 additions
and
0 deletions
openedx/core/djangoapps/user_authn/cookies.py
+
10
−
0
View file @
97fb51ce
...
...
@@ -23,6 +23,7 @@ from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_from_token
from
openedx.core.djangoapps.user_api.accounts.utils
import
retrieve_last_sitewide_block_completed
from
openedx.core.djangoapps.user_authn.exceptions
import
AuthFailedError
from
common.djangoapps.util.json_request
import
JsonResponse
from
common.djangoapps.user_api.accounts.image_helpers
import
get_profile_image_urls_for_user
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -195,9 +196,16 @@ def _set_deprecated_user_info_cookie(response, request, user, cookie_settings):
}
}
"""
image_urls
=
[]
user_info
=
_get_user_info_cookie_data
(
request
,
user
)
if
user
.
profile
and
user
.
profile
.
has_profile_image
:
image_urls
=
get_profile_image_urls_for_user
(
request
,
user
)
print
(
'
image urls
'
)
print
(
image_urls
)
response
.
set_cookie
(
settings
.
EDXMKTG_USER_INFO_COOKIE_NAME
,
json
.
dumps
(
image_urls
),
json
.
dumps
(
user_info
),
**
cookie_settings
)
...
...
@@ -249,6 +257,8 @@ def _get_user_info_cookie_data(request, user):
for
url_name
,
url_path
in
six
.
iteritems
(
header_urls
):
header_urls
[
url_name
]
=
request
.
build_absolute_uri
(
url_path
)
print
(
user
)
user_info
=
{
'
version
'
:
settings
.
EDXMKTG_USER_INFO_COOKIE_VERSION
,
'
username
'
:
user
.
username
,
...
...
This diff is collapsed.
Click to expand it.
openedx/core/djangoapps/user_authn/tests/test_cookies.py
+
1
−
0
View file @
97fb51ce
...
...
@@ -94,6 +94,7 @@ class CookieTests(TestCase):
}
self
.
assertDictEqual
(
actual
,
expected
)
self
.
assertEqual
(
0
,
1
)
def
test_set_logged_in_cookies_anonymous_user
(
self
):
anonymous_user
=
AnonymousUserFactory
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment