Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If there's no password, just take user straight to vote casting page #80

Open
LeanKhan opened this issue Mar 18, 2021 · 4 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@LeanKhan
Copy link
Member

No description provided.

@LeanKhan LeanKhan added the enhancement New feature or request label Mar 18, 2021
@LeanKhan LeanKhan self-assigned this Mar 18, 2021
@AnointingMax AnointingMax self-assigned this Mar 23, 2021
@AnointingMax
Copy link
Collaborator

@LeanKhan I'm not really sure about how to do this. I don't know why this isn't working
`if election.password == "" or election.password == None:
res = make_response(redirect(url_for('election_vote', link=link)))
res.set_cookie('evoting-user-can-vote', str(election.id), expires=int(datetime.timestamp(election.ending_at)))

    return res`

@AnointingMax
Copy link
Collaborator

`
if election.password == "" or election.password == None:
res = make_response(redirect(url_for('election_vote', link=link)))
res.set_cookie('evoting-user-can-vote', str(election.id), expires=int(datetime.timestamp(election.ending_at)))

    return res

`

@LeanKhan
Copy link
Member Author

Okay you want to set a cookie if there's no password for this election. A common issue I faced with setting cookies is the Expiring_at time. To delete a cookie from the backend you have to set that cookie's Expiring time to the past or 0. If you try to set a cookie with an expiring_at time in the past, the browser won't save it at all. So check the ending_at if the election and change it to a time in the future and try again.

@LeanKhan
Copy link
Member Author

You can always see the cookie setting in action by looking at the network tab under devtools. After entering the password or navigating to the voting page, check the request for that page in the Nerworks tab. You should see under "Response" a header passed called "set-cookie" this is what tells your browser to create a cookie. Check it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants