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
730b7c62
Commit
730b7c62
authored
Sep 20, 2013
by
Jason Bau
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1081 from edx/jbau/shib-bugfixes
Jbau/shib bugfixes
parents
b4ce6946
b48e3a96
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
common/djangoapps/external_auth/tests/test_shib.py
+9
-1
common/djangoapps/external_auth/views.py
+6
-7
No files found.
common/djangoapps/external_auth/tests/test_shib.py
View file @
730b7c62
...
...
@@ -514,8 +514,16 @@ class ShibUtilFnTest(TestCase):
"""
def
test__flatten_to_ascii
(
self
):
DIACRITIC
=
u"àèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸåÅçÇ"
# pylint: disable=C0103
STR_DIACRI
=
"àèìòùÀÈÌÒÙáéíóúýÁÉÍÓÚÝâêîôûÂÊÎÔÛãñõÃÑÕäëïöüÿÄËÏÖÜŸåÅçÇ"
# pylint: disable=C0103
FLATTENED
=
u"aeiouAEIOUaeiouyAEIOUYaeiouAEIOUanoANOaeiouyAEIOUYaAcC"
# pylint: disable=C0103
self
.
assertEqual
(
_flatten_to_ascii
(
u'jas
\xf6
n'
),
u'jason'
)
# umlaut
self
.
assertEqual
(
_flatten_to_ascii
(
u'Jason
\u5305
'
),
u'Jason'
)
# mandarin, so it just gets dropped
self
.
assertEqual
(
_flatten_to_ascii
(
u'abc'
),
u'abc'
)
# pass through
self
.
assertEqual
(
_flatten_to_ascii
(
DIACRITIC
),
FLATTENED
)
unicode_test
=
_flatten_to_ascii
(
DIACRITIC
)
self
.
assertEqual
(
unicode_test
,
FLATTENED
)
self
.
assertIsInstance
(
unicode_test
,
unicode
)
str_test
=
_flatten_to_ascii
(
STR_DIACRI
)
self
.
assertEqual
(
str_test
,
FLATTENED
)
self
.
assertIsInstance
(
str_test
,
str
)
common/djangoapps/external_auth/views.py
View file @
730b7c62
...
...
@@ -34,7 +34,6 @@ try:
except
ImportError
:
from
django.contrib.csrf.middleware
import
csrf_exempt
from
django_future.csrf
import
ensure_csrf_cookie
from
util.cache
import
cache_if_anonymous
import
django_openid_auth.views
as
openid_views
from
django_openid_auth
import
auth
as
openid_auth
...
...
@@ -137,8 +136,6 @@ def _external_login_or_signup(request,
fullname
,
retfun
=
None
):
"""Generic external auth login or signup"""
logout
(
request
)
# see if we have a map from this external_id to an edX username
try
:
eamap
=
ExternalAuthMap
.
objects
.
get
(
external_id
=
external_id
,
...
...
@@ -233,13 +230,15 @@ def _flatten_to_ascii(txt):
"""
Flattens possibly unicode txt to ascii (django username limitation)
@param name:
@return:
@return:
the flattened txt (in the same type as was originally passed in)
"""
return
unicodedata
.
normalize
(
'NFKD'
,
txt
)
.
encode
(
'ASCII'
,
'ignore'
)
if
isinstance
(
txt
,
str
):
txt
=
txt
.
decode
(
'utf-8'
)
return
unicodedata
.
normalize
(
'NFKD'
,
txt
)
.
encode
(
'ASCII'
,
'ignore'
)
else
:
return
unicode
(
unicodedata
.
normalize
(
'NFKD'
,
txt
)
.
encode
(
'ASCII'
,
'ignore'
))
@ensure_csrf_cookie
@cache_if_anonymous
def
_signup
(
request
,
eamap
):
"""
Present form to complete for signup via external authentication.
...
...
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