|
|
@ -77,10 +77,6 @@ func usePassword(user string, pass string, ip string) bool { |
|
|
|
log.LogInfo("%+v", toks) |
|
|
|
log.LogInfo("%+v", toks) |
|
|
|
tok := toks[user] |
|
|
|
tok := toks[user] |
|
|
|
delete(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 { |
|
|
|
if tok.IP != ip { |
|
|
|
log.LogWarn(fmt.Sprintf("%s attempted to use an improper IP.", user)) |
|
|
|
log.LogWarn(fmt.Sprintf("%s attempted to use an improper IP.", user)) |
|
|
|
return false |
|
|
|
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)) |
|
|
|
log.LogWarn(fmt.Sprintf("%s attempted to use an improper password. %s vs %s", user, tok.Password, pass)) |
|
|
|
return false |
|
|
|
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 |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|