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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
2e5ed744
Commit
2e5ed744
authored
14 years ago
by
Ben Adida
Browse files
Options
Downloads
Patches
Plain Diff
improved the single ballot page, updated the email to the user to include the link to the ballot
parent
9f7a37d4
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
helios/templates/castvote.html
+9
-1
9 additions, 1 deletion
helios/templates/castvote.html
helios/tests.py
+11
-0
11 additions, 0 deletions
helios/tests.py
helios/views.py
+4
-1
4 additions, 1 deletion
helios/views.py
server_ui/glue.py
+2
-2
2 additions, 2 deletions
server_ui/glue.py
with
26 additions
and
4 deletions
helios/templates/castvote.html
+
9
−
1
View file @
2e5ed744
...
@@ -4,7 +4,15 @@
...
@@ -4,7 +4,15 @@
{% block content %}
{% block content %}
<h2
class=
"title"
>
Cast Vote {{cast_vote.vote_tinyhash}}
</h2>
<h2
class=
"title"
>
Cast Vote {{cast_vote.vote_tinyhash}}
</h2>
cast in
<a
href=
"{% url helios.views.one_election_view election.uuid %}"
>
{{election.name}}
</a><br
/>
cast in
<a
href=
"{% url helios.views.one_election_view election.uuid %}"
>
{{election.name}}
</a><br
/>
by {{voter.name}}
Fingerprint:
<tt>
{{cast_vote.vote_hash}}
</tt><br
/>
by
<b><u>
{{voter.name}}
</u></b>
<br
/><br
/>
<a
href=
"#"
onclick=
"$('#castvote_content').slideToggle(250); return false;"
>
details
</a><br
/><br
/>
<div
style=
"display:none;"
id=
"castvote_content"
>
<textarea
cols=
"100"
rows=
"10"
>
{{vote_content}}
</textarea>
</div>
<br
/><br
/>
<br
/><br
/>
...
...
This diff is collapsed.
Click to expand it.
helios/tests.py
+
11
−
0
View file @
2e5ed744
...
@@ -15,6 +15,7 @@ import utils
...
@@ -15,6 +15,7 @@ import utils
from
django.db
import
IntegrityError
,
transaction
from
django.db
import
IntegrityError
,
transaction
from
django.test.client
import
Client
from
django.test.client
import
Client
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.utils.html
import
escape
as
html_escape
from
django.core
import
mail
from
django.core
import
mail
from
django.core.files
import
File
from
django.core.files
import
File
...
@@ -472,6 +473,16 @@ class ElectionBlackboxTests(TestCase):
...
@@ -472,6 +473,16 @@ class ElectionBlackboxTests(TestCase):
"
status_update
"
:
False
})
"
status_update
"
:
False
})
self
.
assertRedirects
(
response
,
"
%s/helios/elections/%s/cast_done
"
%
(
settings
.
URL_HOST
,
election_id
))
self
.
assertRedirects
(
response
,
"
%s/helios/elections/%s/cast_done
"
%
(
settings
.
URL_HOST
,
election_id
))
# at this point an email should have gone out to the user
# at position num_messages after, since that was the len() before we cast this ballot
email_message
=
mail
.
outbox
[
num_messages_after
]
url
=
re
.
search
(
'
http://[^/]+(/[^
\n
]*)
'
,
email_message
.
body
).
group
(
1
)
# check that we can get at that URL
response
=
self
.
client
.
get
(
url
)
self
.
assertContains
(
response
,
ballot
.
hash
)
self
.
assertContains
(
response
,
html_escape
(
encrypted_vote
))
# encrypted tally
# encrypted tally
response
=
self
.
client
.
post
(
"
/helios/elections/%s/compute_tally
"
%
election_id
,
{
response
=
self
.
client
.
post
(
"
/helios/elections/%s/compute_tally
"
%
election_id
,
{
"
csrf_token
"
:
self
.
client
.
session
[
'
csrf_token
'
]
"
csrf_token
"
:
self
.
client
.
session
[
'
csrf_token
'
]
...
...
This diff is collapsed.
Click to expand it.
helios/views.py
+
4
−
1
View file @
2e5ed744
...
@@ -51,6 +51,9 @@ from django.conf import settings
...
@@ -51,6 +51,9 @@ from django.conf import settings
def
get_election_url
(
election
):
def
get_election_url
(
election
):
return
settings
.
URL_HOST
+
reverse
(
election_shortcut
,
args
=
[
election
.
short_name
])
return
settings
.
URL_HOST
+
reverse
(
election_shortcut
,
args
=
[
election
.
short_name
])
def
get_castvote_url
(
cast_vote
):
return
settings
.
URL_HOST
+
reverse
(
castvote_shortcut
,
args
=
[
cast_vote
.
vote_tinyhash
])
# simple static views
# simple static views
def
home
(
request
):
def
home
(
request
):
user
=
get_user
(
request
)
user
=
get_user
(
request
)
...
@@ -139,7 +142,7 @@ def castvote_shortcut(request, vote_tinyhash):
...
@@ -139,7 +142,7 @@ def castvote_shortcut(request, vote_tinyhash):
raise
Http404
raise
Http404
# FIXME: consider privacy of election
# FIXME: consider privacy of election
return
render_template
(
request
,
'
castvote
'
,
{
'
cast_vote
'
:
cast_vote
,
'
voter
'
:
cast_vote
.
voter
,
'
election
'
:
cast_vote
.
voter
.
election
})
return
render_template
(
request
,
'
castvote
'
,
{
'
cast_vote
'
:
cast_vote
,
'
vote_content
'
:
cast_vote
.
vote
.
toJSON
(),
'
voter
'
:
cast_vote
.
voter
,
'
election
'
:
cast_vote
.
voter
.
election
})
@trustee_check
@trustee_check
def
trustee_keygenerator
(
request
,
election
,
trustee
):
def
trustee_keygenerator
(
request
,
election
,
trustee
):
...
...
This diff is collapsed.
Click to expand it.
server_ui/glue.py
+
2
−
2
View file @
2e5ed744
...
@@ -19,10 +19,10 @@ You have successfully cast a vote in
...
@@ -19,10 +19,10 @@ You have successfully cast a vote in
%s
%s
Your ballot
tracking number is
:
Your ballot
is archived at
:
%s
%s
"""
%
(
election
.
name
,
cast
_
vote
.
vote_hash
)
"""
%
(
election
.
name
,
helios
.
views
.
get_
castvote
_url
(
cast_vote
)
)
if
election
.
use_voter_aliases
:
if
election
.
use_voter_aliases
:
body
+=
"""
body
+=
"""
...
...
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