diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-09-09 15:15:14 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-09-09 15:15:14 -0700 |
commit | c9f9dd3262b9f8437981f92fac100e508e3c3bcd (patch) | |
tree | 16a08ddab87276c6cad972311aa2cfb78843557e /ui/login_check.go | |
parent | c1e1506720e3c8b4e8782da9ff73ce1c57ce71a5 (diff) |
Store client IP address in request context
Diffstat (limited to 'ui/login_check.go')
-rw-r--r-- | ui/login_check.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/login_check.go b/ui/login_check.go index 95c5908..2c5398a 100644 --- a/ui/login_check.go +++ b/ui/login_check.go @@ -16,7 +16,7 @@ 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) + clientIP := request.ClientIP(r) sess := session.New(c.store, request.SessionID(r)) authForm := form.NewAuthForm(r) @@ -31,12 +31,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] [Remote=%v] %v", remoteAddr, err) + logger.Error("[Controller:CheckLogin] [ClientIP=%s] %v", clientIP, err) html.OK(w, r, view.Render("login")) return } - sessionToken, userID, err := c.store.CreateUserSession(authForm.Username, r.UserAgent(), remoteAddr) + sessionToken, userID, err := c.store.CreateUserSession(authForm.Username, r.UserAgent(), clientIP) if err != nil { html.ServerError(w, err) return |