diff options
author | dzaikos <you@example.com> | 2018-08-25 02:47:34 -0400 |
---|---|---|
committer | dzaikos <you@example.com> | 2018-08-25 02:47:34 -0400 |
commit | 4148d8af80ba97b176568c2ac52ffce3721ddde0 (patch) | |
tree | 1c6c5a2f7ab95f4424635b8b01920678cfc833be /ui | |
parent | f43a055d63d33599404d2616bf54216bc74a2506 (diff) |
Added remote client IP to login failure error message.
Fixes #205
Diffstat (limited to 'ui')
-rw-r--r-- | ui/login_check.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ui/login_check.go b/ui/login_check.go index 8f501b8..a2f2826 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 |