mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
parent
f43a055d63
commit
4148d8af80
1 changed files with 4 additions and 2 deletions
|
@ -17,6 +17,8 @@ import (
|
||||||
|
|
||||||
// CheckLogin validates the username/password and redirects the user to the unread page.
|
// CheckLogin validates the username/password and redirects the user to the unread page.
|
||||||
func (c *Controller) CheckLogin(w http.ResponseWriter, r *http.Request) {
|
func (c *Controller) CheckLogin(w http.ResponseWriter, r *http.Request) {
|
||||||
|
remoteAddr := request.RealIP(r)
|
||||||
|
|
||||||
ctx := context.New(r)
|
ctx := context.New(r)
|
||||||
sess := session.New(c.store, ctx)
|
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 {
|
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"))
|
html.OK(w, r, view.Render("login"))
|
||||||
return
|
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 {
|
if err != nil {
|
||||||
html.ServerError(w, err)
|
html.ServerError(w, err)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue