mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 02:40:26 -06:00
Backend auth: remember cookie is needed for oauth logins as well
This commit is contained in:
parent
10e5e5c400
commit
fc47fb8f64
@ -103,15 +103,6 @@ func LoginPost(c *middleware.Context, cmd dtos.LoginCommand) {
|
||||
return
|
||||
}
|
||||
|
||||
// default to true here for now
|
||||
cmd.Remember = true
|
||||
|
||||
if cmd.Remember {
|
||||
days := 86400 * setting.LogInRememberDays
|
||||
c.SetCookie(setting.CookieUserName, user.Login, days, setting.AppSubUrl+"/")
|
||||
c.SetSuperSecureCookie(util.EncodeMd5(user.Rands+user.Password), setting.CookieRememberName, user.Login, days, setting.AppSubUrl+"/")
|
||||
}
|
||||
|
||||
loginUserWithUser(user, c)
|
||||
|
||||
result := map[string]interface{}{
|
||||
@ -133,6 +124,10 @@ func loginUserWithUser(user *m.User, c *middleware.Context) {
|
||||
log.Error(3, "User login with nil user")
|
||||
}
|
||||
|
||||
days := 86400 * setting.LogInRememberDays
|
||||
c.SetCookie(setting.CookieUserName, user.Login, days, setting.AppSubUrl+"/")
|
||||
c.SetSuperSecureCookie(util.EncodeMd5(user.Rands+user.Password), setting.CookieRememberName, user.Login, days, setting.AppSubUrl+"/")
|
||||
|
||||
c.Session.Set(middleware.SESS_KEY_USERID, user.Id)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user