Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
9a2523e4
Commit
9a2523e4
authored
14 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
added explanation of why we ask for rights when someone says no
parent
cd95e88c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
auth/auth_systems/google.py
+3
-0
3 additions, 0 deletions
auth/auth_systems/google.py
auth/urls.py
+1
-0
1 addition, 0 deletions
auth/urls.py
auth/views.py
+25
-14
25 additions, 14 deletions
auth/views.py
with
29 additions
and
14 deletions
auth/auth_systems/google.py
+
3
−
0
View file @
9a2523e4
...
@@ -32,6 +32,9 @@ def get_auth_url(request, redirect_url):
...
@@ -32,6 +32,9 @@ def get_auth_url(request, redirect_url):
def
get_user_info_after_auth
(
request
):
def
get_user_info_after_auth
(
request
):
data
=
view_helpers
.
finish_openid
(
request
.
session
,
request
.
GET
,
request
.
session
[
'
google_redirect_url
'
])
data
=
view_helpers
.
finish_openid
(
request
.
session
,
request
.
GET
,
request
.
session
[
'
google_redirect_url
'
])
if
not
data
.
has_key
(
'
ax
'
):
return
None
email
=
data
[
'
ax
'
][
'
email
'
][
0
]
email
=
data
[
'
ax
'
][
'
email
'
][
0
]
# do we have a firstname/lastname?
# do we have a firstname/lastname?
...
...
This diff is collapsed.
Click to expand it.
auth/urls.py
+
1
−
0
View file @
9a2523e4
...
@@ -17,6 +17,7 @@ urlpatterns = patterns('',
...
@@ -17,6 +17,7 @@ urlpatterns = patterns('',
(
r
'
^start/(?P<system_name>.*)$
'
,
start
),
(
r
'
^start/(?P<system_name>.*)$
'
,
start
),
# weird facebook constraint for trailing slash
# weird facebook constraint for trailing slash
(
r
'
^after/$
'
,
after
),
(
r
'
^after/$
'
,
after
),
(
r
'
^why$
'
,
perms_why
),
(
r
'
^after_intervention$
'
,
after_intervention
),
(
r
'
^after_intervention$
'
,
after_intervention
),
## should make the following modular
## should make the following modular
...
...
This diff is collapsed.
Click to expand it.
auth/views.py
+
25
−
14
View file @
9a2523e4
...
@@ -16,7 +16,7 @@ from auth_systems import AUTH_SYSTEMS
...
@@ -16,7 +16,7 @@ from auth_systems import AUTH_SYSTEMS
from
auth_systems
import
password
from
auth_systems
import
password
import
auth
import
auth
import
copy
import
copy
,
urllib
from
models
import
User
from
models
import
User
...
@@ -137,6 +137,22 @@ def logout(request):
...
@@ -137,6 +137,22 @@ def logout(request):
return
HttpResponseRedirect
(
return_url
)
return
HttpResponseRedirect
(
return_url
)
def
_do_auth
(
request
):
# the session has the system name
system_name
=
request
.
session
[
'
auth_system_name
'
]
# get the system
system
=
AUTH_SYSTEMS
[
system_name
]
# where to send the user to?
redirect_url
=
"
%s%s
"
%
(
settings
.
SECURE_URL_HOST
,
reverse
(
after
))
auth_url
=
system
.
get_auth_url
(
request
,
redirect_url
=
redirect_url
)
if
auth_url
:
return
HttpResponseRedirect
(
auth_url
)
else
:
return
HttpResponse
(
"
an error occurred trying to contact
"
+
system_name
+
"
, try again later
"
)
def
start
(
request
,
system_name
):
def
start
(
request
,
system_name
):
if
not
(
system_name
in
auth
.
ENABLED_AUTH_SYSTEMS
):
if
not
(
system_name
in
auth
.
ENABLED_AUTH_SYSTEMS
):
return
HttpResponseRedirect
(
reverse
(
index
))
return
HttpResponseRedirect
(
reverse
(
index
))
...
@@ -150,17 +166,13 @@ def start(request, system_name):
...
@@ -150,17 +166,13 @@ def start(request, system_name):
# where to return to when done
# where to return to when done
request
.
session
[
'
auth_return_url
'
]
=
request
.
GET
.
get
(
'
return_url
'
,
'
/
'
)
request
.
session
[
'
auth_return_url
'
]
=
request
.
GET
.
get
(
'
return_url
'
,
'
/
'
)
# get the system
return
_do_auth
(
request
)
system
=
AUTH_SYSTEMS
[
system_name
]
# where to send the user to?
def
perms_why
(
request
):
redirect_url
=
"
%s%s
"
%
(
settings
.
SECURE_URL_HOST
,
reverse
(
after
))
if
request
.
method
=
=
"
GET
"
:
auth_url
=
system
.
get_auth_url
(
request
,
redirect_url
=
redirect_url
)
return
render_template
(
request
,
"
perms_why
"
)
if
auth_url
:
return
_do_auth
(
request
)
return
HttpResponseRedirect
(
auth_url
)
else
:
return
HttpResponse
(
"
an error occurred trying to contact
"
+
system_name
+
"
, try again later
"
)
def
after
(
request
):
def
after
(
request
):
# which auth system were we using?
# which auth system were we using?
...
@@ -179,8 +191,7 @@ def after(request):
...
@@ -179,8 +191,7 @@ def after(request):
request
.
session
[
'
user
'
]
=
user
request
.
session
[
'
user
'
]
=
user
else
:
else
:
# we were logging out
return
HttpResponseRedirect
(
"
%s?%s
"
%
(
reverse
(
perms_why
),
urllib
.
urlencode
({
'
system_name
'
:
request
.
session
[
'
auth_system_name
'
]})))
pass
# does the auth system want to present an additional view?
# does the auth system want to present an additional view?
# this is, for example, to prompt the user to follow @heliosvoting
# this is, for example, to prompt the user to follow @heliosvoting
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment