Log successful login attempts in addition to failed ones
This commit is contained in:
parent
7ee8142b38
commit
da0d1cb754
|
@ -456,9 +456,10 @@ func handleLogin(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if len(cookie) == 0 {
|
||||
var ip net.IP
|
||||
ip, err = realIP(r)
|
||||
|
||||
if len(cookie) == 0 {
|
||||
if err != nil {
|
||||
log.Info("auth: getting real ip from request: %s", err)
|
||||
} else if ip == nil {
|
||||
|
@ -474,6 +475,15 @@ func handleLogin(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Info("auth: getting real ip from request: %s", err)
|
||||
} else if ip == nil {
|
||||
// Technically shouldn't happen.
|
||||
log.Info("auth: user %q successfully logged in from unknown ip", req.Name)
|
||||
} else {
|
||||
log.Info("auth: user %q successfully logged in from ip %q", req.Name, ip)
|
||||
}
|
||||
|
||||
w.Header().Set("Set-Cookie", cookie)
|
||||
|
||||
w.Header().Set("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate")
|
||||
|
|
Loading…
Reference in New Issue