diff --git a/auth.go b/auth.go index 0ada75f..7d7c731 100644 --- a/auth.go +++ b/auth.go @@ -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 }