From 4148d8af80ba97b176568c2ac52ffce3721ddde0 Mon Sep 17 00:00:00 2001 From: dzaikos Date: Sat, 25 Aug 2018 02:47:34 -0400 Subject: [PATCH] Added remote client IP to login failure error message. Fixes #205 --- ui/login_check.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/login_check.go b/ui/login_check.go index 8f501b89..a2f28268 100644 --- a/ui/login_check.go +++ b/ui/login_check.go @@ -17,6 +17,8 @@ import ( // CheckLogin validates the username/password and redirects the user to the unread page. func (c *Controller) CheckLogin(w http.ResponseWriter, r *http.Request) { + remoteAddr := request.RealIP(r) + ctx := context.New(r) sess := session.New(c.store, ctx) @@ -33,12 +35,12 @@ func (c *Controller) CheckLogin(w http.ResponseWriter, r *http.Request) { } if err := c.store.CheckPassword(authForm.Username, authForm.Password); err != nil { - logger.Error("[Controller:CheckLogin] %v", err) + logger.Error("[Controller:CheckLogin] [Remote=%v] %v", remoteAddr, err) html.OK(w, r, view.Render("login")) return } - sessionToken, userID, err := c.store.CreateUserSession(authForm.Username, r.UserAgent(), request.RealIP(r)) + sessionToken, userID, err := c.store.CreateUserSession(authForm.Username, r.UserAgent(), remoteAddr) if err != nil { html.ServerError(w, err) return