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
874c3381
Commit
874c3381
authored
Sep 22, 2014
by
Carlos Andrés Rocha
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5316 from rocha/use-default-locale-in-openid-claim
Use default locale to OpenID profile claims.
parents
c35f4bf7
5500cc68
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
lms/djangoapps/oauth2_handler/handlers.py
+7
-0
lms/djangoapps/oauth2_handler/tests.py
+4
-2
No files found.
lms/djangoapps/oauth2_handler/handlers.py
View file @
874c3381
""" Handlers for OpenID Connect provider. """
from
django.conf
import
settings
import
branding
from
courseware.access
import
has_access
from
student.models
import
anonymous_id_for_user
...
...
@@ -51,6 +53,11 @@ class ProfileHandler(object):
"""
language
=
UserPreference
.
get_preference
(
data
[
'user'
],
LANGUAGE_KEY
)
# If the user has no language specified, return the default one.
if
not
language
:
language
=
getattr
(
settings
,
'LANGUAGE_CODE'
)
return
language
...
...
lms/djangoapps/oauth2_handler/tests.py
View file @
874c3381
# pylint: disable=missing-docstring
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
django.test
import
TestCase
...
...
@@ -52,12 +53,13 @@ class IDTokenTest(BaseTestMixin, IDTokenTestCase):
self
.
assertEqual
(
claim_name
,
user_name
)
@override_settings
(
LANGUAGE_CODE
=
'en'
)
def
test_user_without_locale_claim
(
self
):
scopes
,
claims
=
self
.
get_new_id_token_values
(
'openid profile'
)
self
.
assertIn
(
'profile'
,
scopes
)
self
.
assert
NotIn
(
'locale'
,
claims
)
self
.
assert
Equal
(
claims
[
'locale'
],
'en'
)
def
test_user_wit_locale_claim
(
self
):
def
test_user_wit
h
_locale_claim
(
self
):
language
=
'en'
UserPreference
.
set_preference
(
self
.
user
,
LANGUAGE_KEY
,
language
)
scopes
,
claims
=
self
.
get_new_id_token_values
(
'openid profile'
)
...
...
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