Skip to content

Commit 79a2553

Browse files
committed
fix can't not clear session
1 parent d0c63e3 commit 79a2553

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sessions.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,12 @@ func sessionCookieValue(env Env, key string) (value string) {
172172
func cookieChanged(env Env, key, secret string) string {
173173
oldCookieValue := sessionCookieValue(env, key)
174174
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 {
176178
return ""
177179
}
180+
178181
newCookieValue := encodeCookie(value, secret)
179182
if oldCookieValue == newCookieValue {
180183
return ""

0 commit comments

Comments
 (0)