Add allowed time before ident hash expires.

This commit is contained in:
Dominik Picheta 2015-05-29 23:40:06 +01:00
commit 8a22674852

View file

@ -595,7 +595,9 @@ proc verifyIdentHash(c: var TForumData, name, epoch, ident: string): bool =
var row = getRow(db, query, name)
if row[0] == "": return false
let newIdent = makeIdentHash(name, row[0], epoch, row[1], ident)
if row[2].parseInt > epoch.parseInt: return false
# Check that the user has not been logged in since this ident hash has been
# created. Give the timestamp a certain range to prevent false negatives.
if row[2].parseInt > (epoch.parseInt + 60): return false
result = newIdent == ident
proc setBan(c: var TForumData, nick, reason: string): bool =