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
4f029169
Commit
4f029169
authored
Mar 20, 2011
by
Michael Hall
Browse files
Options
Browse Files
Download
Plain Diff
Merge from trunk
parents
63b05e4c
e33d9822
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
django_openid_auth/auth.py
+3
-0
django_openid_auth/tests/test_views.py
+13
-3
No files found.
django_openid_auth/auth.py
View file @
4f029169
...
...
@@ -192,6 +192,9 @@ class OpenIDBackend:
if
details
[
'email'
]:
user
.
email
=
details
[
'email'
]
updated
=
True
if
getattr
(
settings
,
'OPENID_FOLLOW_RENAMES'
,
False
):
user
.
username
=
details
[
'nickname'
]
updated
=
True
if
updated
:
user
.
save
()
...
...
django_openid_auth/tests/test_views.py
View file @
4f029169
...
...
@@ -286,6 +286,10 @@ class RelyingPartyTests(TestCase):
self
.
assertEquals
(
user
.
last_name
,
'User'
)
self
.
assertEquals
(
user
.
email
,
'foo@example.com'
)
def
test_login_update_details_rename
(
self
):
settings
.
OPENID_FOLLOW_RENAMES
=
True
return
self
.
test_login_update_details
()
def
test_login_update_details
(
self
):
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
True
user
=
User
.
objects
.
create_user
(
'testuser'
,
'someone@example.com'
)
...
...
@@ -313,13 +317,19 @@ class RelyingPartyTests(TestCase):
response
=
self
.
complete
(
openid_response
)
self
.
assertRedirects
(
response
,
'http://testserver/getuser/'
)
# And they are now logged in as testuser (the passed in
# If OPENID_FOLLOW_RENAMES, they are logged in as
# someuser (the passed in nickname has changed the username)
#
# Otherwise they are now logged in as testuser (the passed in
# nickname has not caused the username to change).
response
=
self
.
client
.
get
(
'/getuser/'
)
self
.
assertEquals
(
response
.
content
,
'testuser'
)
if
getattr
(
settings
,
'OPENID_FOLLOW_RENAMES'
,
False
):
self
.
assertEquals
(
response
.
content
,
'someuser'
)
else
:
self
.
assertEquals
(
response
.
content
,
'testuser'
)
# The user's full name and email have been updated.
user
=
User
.
objects
.
get
(
username
=
'testuser'
)
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'
)
...
...
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