Backend auth: remember cookie is needed for oauth logins as well

This commit is contained in:
Torkel Ödegaard 2015-04-15 13:38:38 +02:00
parent 10e5e5c400
commit fc47fb8f64

View File

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