If cookie value already exists, then don't let a vote happen

This commit is contained in:
Jonathan Ervine 2020-11-25 22:07:24 +08:00
parent b790b733ea
commit f9aa709a4b

View File

@ -236,6 +236,9 @@ def hkfcD_vote_thanks():
if _motm and _dotd and request.method == 'POST': if _motm and _dotd and request.method == 'POST':
prev_identity = request.cookies.get('sessionID') prev_identity = request.cookies.get('sessionID')
warn(prev_identity) warn(prev_identity)
if prev_identity:
warn("Naughty, naughty, you've already voted!")
else:
identity = randomUrlSuffix(8) identity = randomUrlSuffix(8)
id_commit = "INSERT INTO motmSessions (sessionID) VALUES ('" + identity + "')" id_commit = "INSERT INTO motmSessions (sessionID) VALUES ('" + identity + "')"
sql_write(id_commit) sql_write(id_commit)