Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-openid-auth
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
OpenEdx
django-openid-auth
Commits
3afdf847
Commit
3afdf847
authored
Sep 13, 2011
by
Michael Hall
Browse files
Options
Browse Files
Download
Plain Diff
Fix login conflict when using both STRICT_USERNAMES and FOLLOW_RENAMES
parents
c17ddb15
0bdd740e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
django_openid_auth/auth.py
+8
-2
django_openid_auth/tests/test_views.py
+27
-0
No files found.
django_openid_auth/auth.py
View file @
3afdf847
...
...
@@ -169,8 +169,14 @@ class OpenIDBackend:
claimed_id__exact
=
identity_url
,
user__username__startswith
=
nickname
)
# No exception means we have an existing user for this identity
# that starts with this nickname, so it's possible we've had to
# assign them to nickname+i already.
# that starts with this nickname.
# If they are an exact match, the user already exists and hasn't
# changed their username, so continue to use it
if
nickname
==
user_openid
.
user
.
username
:
return
nickname
# It is possible we've had to assign them to nickname+i already.
oid_username
=
user_openid
.
user
.
username
if
len
(
oid_username
)
>
len
(
nickname
):
try
:
...
...
django_openid_auth/tests/test_views.py
View file @
3afdf847
...
...
@@ -596,6 +596,33 @@ class RelyingPartyTests(TestCase):
self
.
assertEquals
(
user
.
last_name
,
'User'
)
self
.
assertEquals
(
user
.
email
,
'foo@example.com'
)
def
test_login_follow_rename_without_nickname_change
(
self
):
settings
.
OPENID_FOLLOW_RENAMES
=
True
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
True
settings
.
OPENID_STRICT_USERNAMES
=
True
user
=
User
.
objects
.
create_user
(
'testuser'
,
'someone@example.com'
)
useropenid
=
UserOpenID
(
user
=
user
,
claimed_id
=
'http://example.com/identity'
,
display_id
=
'http://example.com/identity'
)
useropenid
.
save
()
openid_req
=
{
'openid_identifier'
:
'http://example.com/identity'
,
'next'
:
'/getuser/'
}
openid_resp
=
{
'nickname'
:
'testuser'
,
'fullname'
:
'Some User'
,
'email'
:
'foo@example.com'
}
self
.
_do_user_login
(
openid_req
,
openid_resp
)
response
=
self
.
client
.
get
(
'/getuser/'
)
# Username should not have changed
self
.
assertEquals
(
response
.
content
,
'testuser'
)
# The user's full name and email have been updated.
user
=
User
.
objects
.
get
(
username
=
response
.
content
)
self
.
assertEquals
(
user
.
first_name
,
'Some'
)
self
.
assertEquals
(
user
.
last_name
,
'User'
)
self
.
assertEquals
(
user
.
email
,
'foo@example.com'
)
def
test_login_follow_rename_conflict
(
self
):
settings
.
OPENID_FOLLOW_RENAMES
=
True
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
True
...
...
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