From 675f9b18d504fd57d27322502ee236dead38d0e4 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Thu, 20 Sep 2018 22:57:42 +0300 Subject: [PATCH 1/2] Delete cookie Right now when the session is destroyed, the session cookie is made empty, not removed. That's an incorrect behavior, the cookie should be deleted as well. For that, we need to set the expiration date to the past, not just an empty value. --- lib/context.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/context.js b/lib/context.js index 90c0c32..b0fafac 100644 --- a/lib/context.js +++ b/lib/context.js @@ -272,7 +272,7 @@ class ContextSession { const externalKey = this.externalKey; if (externalKey) await this.store.destroy(externalKey); - ctx.cookies.set(key, '', opts); + ctx.cookies.set(key, '', {maxAge: -1}); } /** From 00e9ec016518d8bb40d89cb0e07a1ff045acd19e Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Thu, 20 Sep 2018 23:02:19 +0300 Subject: [PATCH 2/2] Update context.js --- lib/context.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/context.js b/lib/context.js index b0fafac..0b80a6d 100644 --- a/lib/context.js +++ b/lib/context.js @@ -272,7 +272,7 @@ class ContextSession { const externalKey = this.externalKey; if (externalKey) await this.store.destroy(externalKey); - ctx.cookies.set(key, '', {maxAge: -1}); + ctx.cookies.set(key, '', { maxAge: -1 }); } /**