mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-16 18:38:52 -07:00
Log successful login attempts in addition to failed ones
This commit is contained in:
parent
7ee8142b38
commit
da0d1cb754
@ -455,10 +455,11 @@ func handleLogin(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var ip net.IP
|
||||
ip, err = realIP(r)
|
||||
|
||||
if len(cookie) == 0 {
|
||||
var ip net.IP
|
||||
ip, err = realIP(r)
|
||||
if err != nil {
|
||||
log.Info("auth: getting real ip from request: %s", err)
|
||||
} else if ip == nil {
|
||||
@ -473,6 +474,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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user