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
ef6a8680
Commit
ef6a8680
authored
Jan 12, 2011
by
Anthony Lenton
Browse files
Options
Browse Files
Download
Plain Diff
Merged in lp:~michael.nelson/django-openid-auth/701484-optional-sreg-fields
parents
2284d64b
834ae37f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
django_openid_auth/tests/test_views.py
+20
-2
django_openid_auth/views.py
+4
-1
No files found.
django_openid_auth/tests/test_views.py
View file @
ef6a8680
...
@@ -27,8 +27,6 @@
...
@@ -27,8 +27,6 @@
# POSSIBILITY OF SUCH DAMAGE.
# POSSIBILITY OF SUCH DAMAGE.
import
cgi
import
cgi
import
re
import
time
import
unittest
import
unittest
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -323,6 +321,26 @@ class RelyingPartyTests(TestCase):
...
@@ -323,6 +321,26 @@ class RelyingPartyTests(TestCase):
self
.
assertEquals
(
user
.
last_name
,
'User'
)
self
.
assertEquals
(
user
.
last_name
,
'User'
)
self
.
assertEquals
(
user
.
email
,
'foo@example.com'
)
self
.
assertEquals
(
user
.
email
,
'foo@example.com'
)
def
test_login_uses_sreg_extra_fields
(
self
):
# The configurable sreg attributes are used in the request.
settings
.
OPENID_SREG_EXTRA_FIELDS
=
(
'language'
,)
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
()
# Posting in an identity URL begins the authentication request:
response
=
self
.
client
.
post
(
'/openid/login/'
,
{
'openid_identifier'
:
'http://example.com/identity'
,
'next'
:
'/getuser/'
})
openid_request
=
self
.
provider
.
parseFormPost
(
response
.
content
)
sreg_request
=
sreg
.
SRegRequest
.
fromOpenIDRequest
(
openid_request
)
for
field
in
(
'email'
,
'fullname'
,
'nickname'
,
'language'
):
self
.
assertTrue
(
field
in
sreg_request
)
def
test_login_attribute_exchange
(
self
):
def
test_login_attribute_exchange
(
self
):
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
True
settings
.
OPENID_UPDATE_DETAILS_FROM_SREG
=
True
user
=
User
.
objects
.
create_user
(
'testuser'
,
'someone@example.com'
)
user
=
User
.
objects
.
create_user
(
'testuser'
,
'someone@example.com'
)
...
...
django_openid_auth/views.py
View file @
ef6a8680
...
@@ -194,8 +194,11 @@ def login_begin(request, template_name='openid/login.html',
...
@@ -194,8 +194,11 @@ def login_begin(request, template_name='openid/login.html',
fetch_request
.
add
(
ax
.
AttrInfo
(
attr
,
alias
=
alias
,
required
=
True
))
fetch_request
.
add
(
ax
.
AttrInfo
(
attr
,
alias
=
alias
,
required
=
True
))
openid_request
.
addExtension
(
fetch_request
)
openid_request
.
addExtension
(
fetch_request
)
else
:
else
:
sreg_optional_fields
=
[
'email'
,
'fullname'
,
'nickname'
]
extra_fields
=
getattr
(
settings
,
'OPENID_SREG_EXTRA_FIELDS'
,
[])
sreg_optional_fields
.
extend
(
extra_fields
)
openid_request
.
addExtension
(
openid_request
.
addExtension
(
sreg
.
SRegRequest
(
optional
=
[
'email'
,
'fullname'
,
'nickname'
]
))
sreg
.
SRegRequest
(
optional
=
sreg_optional_fields
))
# Request team info
# Request team info
teams_mapping_auto
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING_AUTO'
,
False
)
teams_mapping_auto
=
getattr
(
settings
,
'OPENID_LAUNCHPAD_TEAMS_MAPPING_AUTO'
,
False
)
...
...
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