1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-17 17:50:54 +00:00

Update session.go

move expire in line 154 to 247, because it will cause session_cookie not writen to explorer
This commit is contained in:
Yongzheng Lai 2015-04-03 17:41:09 +08:00
parent e675594e46
commit a5124a1d45

View File

@ -151,7 +151,6 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se
Domain: manager.config.Domain} Domain: manager.config.Domain}
if manager.config.CookieLifeTime >= 0 { if manager.config.CookieLifeTime >= 0 {
cookie.MaxAge = manager.config.CookieLifeTime cookie.MaxAge = manager.config.CookieLifeTime
cookie.Expires = time.Now().Add(time.Duration(manager.config.CookieLifeTime) * time.Second)
} }
if manager.config.EnableSetCookie { if manager.config.EnableSetCookie {
http.SetCookie(w, cookie) http.SetCookie(w, cookie)
@ -245,6 +244,7 @@ func (manager *Manager) SessionRegenerateId(w http.ResponseWriter, r *http.Reque
} }
if manager.config.CookieLifeTime >= 0 { if manager.config.CookieLifeTime >= 0 {
cookie.MaxAge = manager.config.CookieLifeTime cookie.MaxAge = manager.config.CookieLifeTime
cookie.Expires = time.Now().Add(time.Duration(manager.config.CookieLifeTime) * time.Second)
} }
http.SetCookie(w, cookie) http.SetCookie(w, cookie)
r.AddCookie(cookie) r.AddCookie(cookie)