From f2f6fbf15ac1f880343abd0828964036c0537831 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 13 Apr 2020 13:26:17 -0400 Subject: [PATCH] fix: #8232, unresolvable session mismatch on register cancel --- src/controllers/authentication.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index bb3768169f..29eb6603c9 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -195,6 +195,7 @@ authenticationController.registerComplete = function (req, res, next) { authenticationController.registerAbort = function (req, res) { // End the session and redirect to home req.session.destroy(function () { + res.clearCookie(nconf.get('sessionKey'), meta.configs.cookie.get()); res.redirect(nconf.get('relative_path') + '/'); }); }; @@ -423,9 +424,7 @@ authenticationController.logout = async function (req, res, next) { req.logout(); await destroyAsync(req); - res.clearCookie(nconf.get('sessionKey'), { - path: nconf.get('relative_path'), - }); + res.clearCookie(nconf.get('sessionKey'), meta.configs.cookie.get()); req.uid = 0; req.headers['x-csrf-token'] = req.csrfToken();