Skip to content

Instantly share code, notes, and snippets.

@ejucovy
Created October 14, 2016 16:02
Show Gist options
  • Save ejucovy/87fa736267f6dfd0218a95630ce1acd2 to your computer and use it in GitHub Desktop.
Save ejucovy/87fa736267f6dfd0218a95630ce1acd2 to your computer and use it in GitHub Desktop.
diff --git a/opendebates/views.py b/opendebates/views.py
index b388b09..f424874 100644
--- a/opendebates/views.py
+++ b/opendebates/views.py
@@ -21,7 +21,8 @@ from .models import Candidate, Category, Flag, Submission, \
from .router import readonly_db
from .utils import get_ip_address_from_request, get_headers_from_request, choose_sort, sort_list, \
vote_needs_captcha, registration_needs_captcha, show_question_votes, \
- allow_voting_and_submitting_questions, get_local_votes_state, get_previous_debate_time
+ allow_voting_and_submitting_questions, get_local_votes_state, get_previous_debate_time, \
+ get_voter
# from opendebates_comments.forms import CommentForm
from opendebates_emails.models import send_email
@@ -215,8 +216,9 @@ def vote(request, id):
}
state = state_from_zip(form.cleaned_data['zipcode'])
- if request.user.is_authenticated():
- if request.user.email != form.cleaned_data['email']:
+ session_voter = get_voter()
+ if session_voter:
+ if session_voter['email'] != form.cleaned_data['email']:
# this can only happen with an manually-created POST request
return HttpResponseBadRequest('Incorrect email for user')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment