is voter missing

This commit is contained in:
Ville Rantanen
2018-12-13 22:02:08 +02:00
parent f928449666
commit a1cf9ddc64
2 changed files with 17 additions and 0 deletions

View File

@@ -155,6 +155,19 @@ def is_show_results(form):
return form['show_results']
def is_voter(key, token):
if token == None:
return False
cur = g.db.cursor()
cur.execute(
"SELECT token FROM tokens WHERE token = ? AND question_set = ? AND role = 'voter'",
(
get_hash(token),
key
)
)
return len(cur.fetchall()) > 0
def parse_form(key):
form = {
'expires': None,