diff --git a/helios/templates/voters_list.html b/helios/templates/voters_list.html index 3b345a06bc4f0d05eed048bf76cf17c333be897d..88145e1fc22695f426f47a5aacd1faab84082644 100644 --- a/helios/templates/voters_list.html +++ b/helios/templates/voters_list.html @@ -143,7 +143,7 @@ Voters {{voters_page.start_index}} - {{voters_page.end_index}} (of {{total_voter {% if election.use_voter_aliases %} <td>{{voter.alias}}</td> {% endif %} -<td><tt style="font-size: 1.4em;">{% if voter.vote_hash %}{{voter.vote_hash}} <span style="font-size:0.8em;">[<a href="{% url "shortcut@vote" vote_tinyhash=voter.vote_tinyhash %}">view</a>]</span>{% else %}—{% endif %}</tt></td> +<td><tt style="font-size: 1.4em;">{% if voter.vote_hash %}{{voter.vote_hash}} <span style="font-size:0.8em;">[<a href="{% url "shortcut-fullhash@vote" vote_hash=voter.vote_hash %}">view</a>]</span>{% else %}—{% endif %}</tt></td> </tr> {% endfor %} </table> diff --git a/helios/url_names.py b/helios/url_names.py index 319a9be5bd72a11144e4917823e3433b378d405a..1b0caac652c81db1741175645eb45c73929aaaf7 100644 --- a/helios/url_names.py +++ b/helios/url_names.py @@ -3,7 +3,7 @@ from helios import election_url_names as election, stats_url_names as stats __all__ = [ "election", "stats", "COOKIE_TEST", "COOKIE_TEST_2", "COOKIE_NO", - "ELECTION_SHORTCUT", "ELECTION_SHORTCUT_VOTE", "CAST_VOTE_SHORTCUT", + "ELECTION_SHORTCUT", "ELECTION_SHORTCUT_VOTE", "CAST_VOTE_SHORTCUT", "CAST_VOTE_FULLHASH_SHORTCUT", "TRUSTEE_LOGIN", "ELECTIONS_PARAMS", "ELECTIONS_VERIFIER", "ELECTIONS_VERIFIER_SINGLE_BALLOT", "ELECTIONS_NEW", "ELECTIONS_ADMINISTERED", "ELECTIONS_VOTED", @@ -16,6 +16,7 @@ COOKIE_NO="cookie@no" ELECTION_SHORTCUT="shortcut@election" ELECTION_SHORTCUT_VOTE="shortcut@election@vote" CAST_VOTE_SHORTCUT="shortcut@vote" +CAST_VOTE_FULLHASH_SHORTCUT="shortcut-fullhash@vote" TRUSTEE_LOGIN="trustee@login" diff --git a/helios/urls.py b/helios/urls.py index 9183eedd1fdc4e2c7fd89535b557d972106fc216..f03c4a78183a34cc1168c11aea1a822706a08101 100644 --- a/helios/urls.py +++ b/helios/urls.py @@ -16,6 +16,9 @@ urlpatterns = [ # vote shortcut url(r'^v/(?P<vote_tinyhash>[^/]+)$', views.castvote_shortcut, name=names.CAST_VOTE_SHORTCUT), + + # vote by hash + url(r'^vh/(?P<vote_hash>[^/]+)$', views.castvote_fullhash_shortcut, name=names.CAST_VOTE_FULLHASH_SHORTCUT), # trustee login url(r'^t/(?P<election_short_name>[^/]+)/(?P<trustee_email>[^/]+)/(?P<trustee_secret>[^/]+)$', views.trustee_login, diff --git a/helios/views.py b/helios/views.py index 9be3a316677d9459ed5f953ad579e950b82ec514..f054ecd0ea93a00ef02663c1443d6a864845572b 100644 --- a/helios/views.py +++ b/helios/views.py @@ -147,6 +147,14 @@ def castvote_shortcut(request, vote_tinyhash): return _castvote_shortcut_by_election(request, election_uuid = cast_vote.voter.election.uuid, cast_vote=cast_vote) +def castvote_fullhash_shortcut(request, vote_hash): + try: + cast_vote = CastVote.objects.get(vote_hash = vote_hash) + except CastVote.DoesNotExist: + raise Http404 + + return _castvote_shortcut_by_election(request, election_uuid = cast_vote.voter.election.uuid, cast_vote=cast_vote) + @trustee_check def trustee_keygenerator(request, election, trustee): """