Node.js based forum software built for the modern web
fix(auth): clear session info when switching users in doLogin
Julian Lam7ef88c377e96
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.jsindex 74b4e8b5ae..485b069fec 100644--- a/src/controllers/authentication.js+++ b/src/controllers/authentication.js@@ -320,7 +320,7 @@ authenticationController.doLogin = async function (req, uid) {return;}const loginAsync = util.promisify(req.login).bind(req);- const keepSessionInfo = (req?.res?.locals?.reroll !== false) && uid === req.uid;+ const keepSessionInfo = (req?.res?.locals?.reroll !== false) && !(req.loggedIn && uid !== req.uid);await loginAsync({ uid: uid }, { keepSessionInfo });await authenticationController.onSuccessfulLogin(req, uid);};