Authy
This commit is contained in:
8
auth.go
8
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user