From e327d1247ec6bc4882e873b23e2b8a7ce33cedcb Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 20 May 2020 11:27:13 -0400 Subject: [PATCH] Revert "fix: #8142 invalid session warning if server-side session destroyed" This reverts commit 526b3cd9ec52c934dfdedc149c8534f65b665e6d. --- src/middleware/headers.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/middleware/headers.js b/src/middleware/headers.js index a3642f3fbb..32d87721dd 100644 --- a/src/middleware/headers.js +++ b/src/middleware/headers.js @@ -56,9 +56,8 @@ module.exports = function (middleware) { } // Ensure that the session is valid. This block guards against edge-cases where the server-side session has - // been deleted (but client-side cookie still exists). - // req.session.flash is present if you visit register/login, so all logged-in users have it, but it is missing if your server-side session got destroyed. - if (!req.session.flash && !req.session.meta && !res.get('Set-Cookie')) { + // been deleted (but client-side cookie still exists) + if (req.uid > 0 && !req.session.meta && !res.get('Set-Cookie')) { res.clearCookie(nconf.get('sessionKey'), meta.configs.cookie.get()); }