1
0
Fork 0

Added remote client IP to login failure error message.

Fixes #205
This commit is contained in:
dzaikos 2018-08-25 02:47:34 -04:00
parent f43a055d63
commit 4148d8af80

View file

@ -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