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

Merge pull request #1114 from ElvizLai/patch-2

Patch 2
This commit is contained in:
astaxie 2015-04-04 13:03:44 +08:00
commit ac6203b81b

View File

@ -149,7 +149,7 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se
HttpOnly: true, HttpOnly: true,
Secure: manager.config.Secure, Secure: manager.config.Secure,
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) cookie.Expires = time.Now().Add(time.Duration(manager.config.CookieLifeTime) * time.Second)
} }
@ -176,7 +176,7 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se
HttpOnly: true, HttpOnly: true,
Secure: manager.config.Secure, Secure: manager.config.Secure,
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) cookie.Expires = time.Now().Add(time.Duration(manager.config.CookieLifeTime) * time.Second)
} }
@ -243,8 +243,9 @@ func (manager *Manager) SessionRegenerateId(w http.ResponseWriter, r *http.Reque
cookie.HttpOnly = true cookie.HttpOnly = true
cookie.Path = "/" cookie.Path = "/"
} }
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)