def refreshVerification(email): db = get_db() dt = query_db("SELECT datetime('now','localtime')", one=True) t = (dt[0], email) db.execute("UPDATE VERIFICATION SET timestamp=? WHERE email=(?)", t) updateVerificationCount(email, 1) g.db.commit()
def addVerification(email, token): db = get_db() dt = query_db("SELECT datetime('now','localtime')", one=True) t = (token, dt[0], email) db.execute("INSERT INTO VERIFICATION values(?,?,'0',?)", t) updateVerificationCount(email, 1) g.db.commit()
def verificationFromToday(email): g.db = get_db() t = (email, ) result = query_db("SELECT count(strftime('%Y-%m-%d',timestamp,'localtime')) from verification WHERE strftime(" + \ "'%Y-%m-%d',timestamp,'localtime')=strftime('%Y-%m-%d','now','localtime') and email=?",t,one=True) count = result[0] return count == 1
def makeEmailActive(email): g.db = get_db() t = (email, ) g.db.execute('UPDATE USERS SET isVerified=1 WHERE email=?', t) g.db.commit()
def updateVerificationCount(email, count): t = (count, email) g.db = get_db() g.db.execute('UPDATE verification SET count=? WHERE email=?', t) g.db.commit()
def resetVerificationCount(email): g.db = get_db() t = (email, ) g.db.execute('UPDATE verification SET count=0 WHERE email=?', t) g.db.commit()