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
5cb37e85
Commit
5cb37e85
authored
Sep 22, 2015
by
Ricardo Kirkner
Browse files
Options
Browse Files
Download
Plain Diff
support custom user model instead of hardcoded contrib User model
this requires to depend on django >= 1.5
parents
d091f448
5b0d782e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
15 deletions
+13
-15
django_openid_auth/admin.py
+2
-2
django_openid_auth/auth.py
+5
-1
django_openid_auth/models.py
+3
-2
setup.py
+2
-2
tox.ini
+1
-8
No files found.
django_openid_auth/admin.py
View file @
5cb37e85
...
@@ -97,8 +97,8 @@ def _openid_login(instance, request, error_message='', extra_context=None):
...
@@ -97,8 +97,8 @@ def _openid_login(instance, request, error_message='', extra_context=None):
if
not
request
.
user
.
is_staff
:
if
not
request
.
user
.
is_staff
:
return
views
.
default_render_failure
(
return
views
.
default_render_failure
(
request
,
"
User
%
s does not have admin/staff access."
request
,
"
%
s
%
s does not have admin/staff access."
%
request
.
user
.
username
)
%
(
settings
.
AUTH_USER_MODEL
,
request
.
user
.
username
)
)
# No error message was supplied
# No error message was supplied
assert
error_message
,
"Unknown Error:
%
s"
%
error_message
assert
error_message
,
"Unknown Error:
%
s"
%
error_message
...
...
django_openid_auth/auth.py
View file @
5cb37e85
...
@@ -35,7 +35,8 @@ __metaclass__ = type
...
@@ -35,7 +35,8 @@ __metaclass__ = type
import
re
import
re
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
,
Group
,
Permission
from
django.contrib.auth
import
get_user_model
from
django.contrib.auth.models
import
Group
,
Permission
from
openid.consumer.consumer
import
SUCCESS
from
openid.consumer.consumer
import
SUCCESS
from
openid.extensions
import
ax
,
sreg
,
pape
from
openid.extensions
import
ax
,
sreg
,
pape
...
@@ -50,6 +51,9 @@ from django_openid_auth.exceptions import (
...
@@ -50,6 +51,9 @@ from django_openid_auth.exceptions import (
)
)
User
=
get_user_model
()
class
OpenIDBackend
:
class
OpenIDBackend
:
"""A django.contrib.auth backend that authenticates the user based on
"""A django.contrib.auth backend that authenticates the user based on
an OpenID response."""
an OpenID response."""
...
...
django_openid_auth/models.py
View file @
5cb37e85
...
@@ -29,8 +29,9 @@
...
@@ -29,8 +29,9 @@
from
__future__
import
unicode_literals
from
__future__
import
unicode_literals
from
django.conf
import
settings
from
django.db
import
models
from
django.db
import
models
from
django.contrib.auth.models
import
Permission
,
User
from
django.contrib.auth.models
import
Permission
class
Nonce
(
models
.
Model
):
class
Nonce
(
models
.
Model
):
...
@@ -55,7 +56,7 @@ class Association(models.Model):
...
@@ -55,7 +56,7 @@ class Association(models.Model):
class
UserOpenID
(
models
.
Model
):
class
UserOpenID
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
)
user
=
models
.
ForeignKey
(
settings
.
AUTH_USER_MODEL
)
claimed_id
=
models
.
TextField
(
max_length
=
2047
,
unique
=
True
)
claimed_id
=
models
.
TextField
(
max_length
=
2047
,
unique
=
True
)
display_id
=
models
.
TextField
(
max_length
=
2047
)
display_id
=
models
.
TextField
(
max_length
=
2047
)
...
...
setup.py
View file @
5cb37e85
...
@@ -43,7 +43,7 @@ from setuptools import find_packages, setup
...
@@ -43,7 +43,7 @@ from setuptools import find_packages, setup
description
,
long_description
=
__doc__
.
split
(
'
\n\n
'
,
1
)
description
,
long_description
=
__doc__
.
split
(
'
\n\n
'
,
1
)
VERSION
=
'0.
6
'
VERSION
=
'0.
7
'
setup
(
setup
(
name
=
'django-openid-auth'
,
name
=
'django-openid-auth'
,
...
@@ -51,7 +51,7 @@ setup(
...
@@ -51,7 +51,7 @@ setup(
packages
=
find_packages
(),
packages
=
find_packages
(),
install_requires
=
[
install_requires
=
[
'django>=1.
4
'
,
'django>=1.
5
'
,
'python-openid>=2.2.0'
,
'python-openid>=2.2.0'
,
'south'
,
'south'
,
],
],
...
...
tox.ini
View file @
5cb37e85
[tox]
[tox]
envlist
=
envlist
=
py2.7-django1.
4,
py2.7-django1.
5,
py2.7-django1.6,
py2.7-django1.7,
py2.7-django1.8
py2.7-django1.5,
py2.7-django1.6,
py2.7-django1.7,
py2.7-django1.8
[testenv]
[testenv]
commands
=
python manage.py test django_openid_auth
commands
=
python manage.py test django_openid_auth
...
@@ -8,13 +8,6 @@ deps=
...
@@ -8,13 +8,6 @@ deps=
mock
mock
python-openid
python-openid
[testenv:py2.7-django1.4]
basepython
=
python2.7
deps
=
django
>=
1.4,
<
1.5
{
[testenv]
deps}
south
=
=1.0
[testenv:py2.7-django1.5]
[testenv:py2.7-django1.5]
basepython
=
python2.7
basepython
=
python2.7
deps
=
deps
=
...
...
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