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
cd95e88c
Commit
cd95e88c
authored
Jul 3, 2011
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
added reauth
parent
dae3ae3f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
helios/views.py
+20
-8
20 additions, 8 deletions
helios/views.py
with
20 additions
and
8 deletions
helios/views.py
+
20
−
8
View file @
cd95e88c
...
@@ -78,6 +78,20 @@ def get_socialbuttons_url(url, text):
...
@@ -78,6 +78,20 @@ def get_socialbuttons_url(url, text):
}))
}))
##
## remote auth utils
def
user_reauth
(
request
,
user
):
# FIXME: should we be wary of infinite redirects here, and
# add a parameter to prevent it? Maybe.
login_url
=
"
%s%s?%s
"
%
(
settings
.
SECURE_URL_HOST
,
reverse
(
auth_views
.
start
,
args
=
[
user
.
user_type
]),
urllib
.
urlencode
({
'
return_url
'
:
request
.
get_full_path
()}))
return
HttpResponseRedirect
(
login_url
)
##
# simple static views
# simple static views
def
home
(
request
):
def
home
(
request
):
user
=
get_user
(
request
)
user
=
get_user
(
request
)
...
@@ -308,13 +322,7 @@ def one_election_view(request, election):
...
@@ -308,13 +322,7 @@ def one_election_view(request, election):
try
:
try
:
eligible_p
=
_check_eligibility
(
election
,
user
)
eligible_p
=
_check_eligibility
(
election
,
user
)
except
AuthenticationExpired
:
except
AuthenticationExpired
:
# FIXME: should we be wary of infinite redirects here, and
return
user_reauth
(
request
,
user
)
# add a parameter to prevent it? Maybe.
login_url
=
"
%s%s?%s
"
%
(
settings
.
SECURE_URL_HOST
,
reverse
(
auth_views
.
start
,
args
=
[
user
.
user_type
]),
urllib
.
urlencode
({
'
return_url
'
:
request
.
get_full_path
()}))
return
HttpResponseRedirect
(
login_url
)
notregistered
=
True
notregistered
=
True
else
:
else
:
voter
=
get_voter
(
request
,
user
,
election
)
voter
=
get_voter
(
request
,
user
,
election
)
...
@@ -1135,9 +1143,13 @@ def voters_list_pretty(request, election):
...
@@ -1135,9 +1143,13 @@ def voters_list_pretty(request, election):
categories
=
None
categories
=
None
eligibility_category_id
=
None
eligibility_category_id
=
None
try
:
if
admin_p
and
can_list_categories
(
user
.
user_type
):
if
admin_p
and
can_list_categories
(
user
.
user_type
):
categories
=
AUTH_SYSTEMS
[
user
.
user_type
].
list_categories
(
user
)
categories
=
AUTH_SYSTEMS
[
user
.
user_type
].
list_categories
(
user
)
eligibility_category_id
=
election
.
eligibility_category_id
(
user
.
user_type
)
eligibility_category_id
=
election
.
eligibility_category_id
(
user
.
user_type
)
except
AuthenticationExpired
:
return
user_reauth
(
request
,
user
)
# files being processed
# files being processed
voter_files
=
election
.
voterfile_set
.
all
()
voter_files
=
election
.
voterfile_set
.
all
()
...
...
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