diff --git a/internal/home/auth.go b/internal/home/auth.go index bfcc7267..f3001153 100644 --- a/internal/home/auth.go +++ b/internal/home/auth.go @@ -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)