Update session.go
move expire in line 154 to 247, because it will cause session_cookie not writen to explorer
Showing
1 changed file
with
1 additions
and
1 deletions
| ... | @@ -151,7 +151,6 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se | ... | @@ -151,7 +151,6 @@ func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (se |
| 151 | Domain: manager.config.Domain} | 151 | Domain: manager.config.Domain} |
| 152 | if manager.config.CookieLifeTime >= 0 { | 152 | if manager.config.CookieLifeTime >= 0 { |
| 153 | cookie.MaxAge = manager.config.CookieLifeTime | 153 | cookie.MaxAge = manager.config.CookieLifeTime |
| 154 | cookie.Expires = time.Now().Add(time.Duration(manager.config.CookieLifeTime) * time.Second) | ||
| 155 | } | 154 | } |
| 156 | if manager.config.EnableSetCookie { | 155 | if manager.config.EnableSetCookie { |
| 157 | http.SetCookie(w, cookie) | 156 | http.SetCookie(w, cookie) |
| ... | @@ -245,6 +244,7 @@ func (manager *Manager) SessionRegenerateId(w http.ResponseWriter, r *http.Reque | ... | @@ -245,6 +244,7 @@ func (manager *Manager) SessionRegenerateId(w http.ResponseWriter, r *http.Reque |
| 245 | } | 244 | } |
| 246 | if manager.config.CookieLifeTime >= 0 { | 245 | if manager.config.CookieLifeTime >= 0 { |
| 247 | cookie.MaxAge = manager.config.CookieLifeTime | 246 | cookie.MaxAge = manager.config.CookieLifeTime |
| 247 | cookie.Expires = time.Now().Add(time.Duration(manager.config.CookieLifeTime) * time.Second) | ||
| 248 | } | 248 | } |
| 249 | http.SetCookie(w, cookie) | 249 | http.SetCookie(w, cookie) |
| 250 | r.AddCookie(cookie) | 250 | r.AddCookie(cookie) | ... | ... |
-
Please register or sign in to post a comment