Skip to content
This repository
Browse code

fix can't not clear session

  • Loading branch information...
commit 79a2553db18c45be0fc7b838b1759dc37961bd20 1 parent d0c63e3
Felix Sun sunfmin authored

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. +4 1 sessions.go
5 sessions.go
@@ -172,9 +172,12 @@ func sessionCookieValue(env Env, key string) (value string) {
172 172 func cookieChanged(env Env, key, secret string) string {
173 173 oldCookieValue := sessionCookieValue(env, key)
174 174 value := env["mango.session"].(map[string]interface{})
175   - if len(value) == 0 {
  175 +
  176 + // old and new both are empty
  177 + if oldCookieValue == "" && len(value) == 0 {
176 178 return ""
177 179 }
  180 +
178 181 newCookieValue := encodeCookie(value, secret)
179 182 if oldCookieValue == newCookieValue {
180 183 return ""

0 comments on commit 79a2553

Please sign in to comment.
Something went wrong with that request. Please try again.