This commit is contained in:
2020-12-30 12:10:42 -05:00
parent f31215027a
commit 8460b10e9f

View File

@ -77,10 +77,6 @@ func usePassword(user string, pass string, ip string) bool {
log.LogInfo("%+v", toks)
tok := toks[user]
delete(toks, user)
if time.Since(tok.Timestamp) > (time.Minute * 5) {
log.LogWarn("%s attempted to use expired token. \n%+v\n%+v\n%+v", user, time.Since(tok.Timestamp), tok.Timestamp, time.Now())
return false
}
if tok.IP != ip {
log.LogWarn(fmt.Sprintf("%s attempted to use an improper IP.", user))
return false
@ -89,6 +85,10 @@ func usePassword(user string, pass string, ip string) bool {
log.LogWarn(fmt.Sprintf("%s attempted to use an improper password. %s vs %s", user, tok.Password, pass))
return false
}
if time.Since(tok.Timestamp) > (time.Minute * 5) {
log.LogWarn("%s attempted to use expired token. \n%+v\n%+v\n%+v", user, time.Since(tok.Timestamp), tok.Timestamp, time.Now())
return false
}
return true
}