From 556065a9e8851b7f98824244af74a63ae8ce228c Mon Sep 17 00:00:00 2001
From: Ben Adida <ben@adida.net>
Date: Mon, 28 Feb 2011 21:53:48 -0800
Subject: [PATCH] updated bad voter login UI

---
 helios/templates/_castconfirm_password.html | 5 +++++
 helios/views.py                             | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/helios/templates/_castconfirm_password.html b/helios/templates/_castconfirm_password.html
index 9e17c26..ecce510 100644
--- a/helios/templates/_castconfirm_password.html
+++ b/helios/templates/_castconfirm_password.html
@@ -4,5 +4,10 @@ Please provide the username and password you received by email.<br /><br />
 <table>
     {{password_login_form.as_table}}
 </table>
+{% if bad_voter_login %}
+<p style="color: red;">
+bad voter ID or password, please try again.
+</p>
+{% endif %}
 <input type="submit" value="check credentials" />
 </form>
diff --git a/helios/views.py b/helios/views.py
index f851918..d31e4ac 100644
--- a/helios/views.py
+++ b/helios/views.py
@@ -508,7 +508,7 @@ def password_voter_login(request, election):
 
       request.session['CURRENT_VOTER'] = voter
     except Voter.DoesNotExist:
-      pass
+        return HttpResponseRedirect(reverse(one_election_cast_confirm, args = [election.uuid]) + "?bad_voter_login=1")
   
   return HttpResponseRedirect(reverse(one_election_cast_confirm, args = [election.uuid]))
 
@@ -563,6 +563,8 @@ def one_election_cast_confirm(request, election):
     else:
       issues = None
 
+    bad_voter_login = (request.GET.get('bad_voter_login', "0") == "1")
+
     # status update this vote
     if voter and voter.user.can_update_status():
       status_update_label = voter.user.update_status_template() % "your smart ballot tracker"
@@ -596,7 +598,8 @@ def one_election_cast_confirm(request, election):
         'login_box': login_box, 'election' : election, 'vote_fingerprint': vote_fingerprint,
         'past_votes': past_votes, 'issues': issues, 'voter' : voter,
         'status_update_label': status_update_label, 'status_update_message': status_update_message,
-        'show_password': show_password, 'password_only': password_only, 'password_login_form': password_login_form})
+        'show_password': show_password, 'password_only': password_only, 'password_login_form': password_login_form,
+        'bad_voter_login': bad_voter_login})
       
   if request.method == "POST":
     check_csrf(request)
-- 
GitLab