Skip to content
Snippets Groups Projects
Commit 6f51eb1b authored by Ben Adida's avatar Ben Adida
Browse files

add better error handling of edge cases that are causing the most errors

parent 67adf338
No related branches found
No related tags found
No related merge requests found
...@@ -592,7 +592,7 @@ def one_election_cast_confirm(request, election): ...@@ -592,7 +592,7 @@ def one_election_cast_confirm(request, election):
user = get_user(request) user = get_user(request)
# if no encrypted vote, the user is reloading this page or otherwise getting here in a bad way # if no encrypted vote, the user is reloading this page or otherwise getting here in a bad way
if not request.session.has_key('encrypted_vote'): if (not request.session.has_key('encrypted_vote')) or request.session['encrypted_vote'] == None:
return HttpResponseRedirect(settings.URL_HOST) return HttpResponseRedirect(settings.URL_HOST)
# election not frozen or started # election not frozen or started
......
...@@ -33,7 +33,9 @@ def get_auth_url(request, redirect_url): ...@@ -33,7 +33,9 @@ def get_auth_url(request, redirect_url):
def get_user_info_after_auth(request): def get_user_info_after_auth(request):
flow = get_flow(request.session['google-redirect-url']) flow = get_flow(request.session['google-redirect-url'])
del request.session['google-redirect-url']
if not request.GET.has_key('code'):
return None
code = request.GET['code'] code = request.GET['code']
credentials = flow.step2_exchange(code) credentials = flow.step2_exchange(code)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment