Node.js based forum software built for the modern web
fix: #9487, session data gathered during a session is lost upon login
Julian Lam1fee6a702aa2
diff --git a/src/controllers/authentication.js b/src/controllers/authentication.jsindex 0542355bb6..f5d44dec36 100644--- a/src/controllers/authentication.js+++ b/src/controllers/authentication.js@@ -328,7 +328,12 @@ authenticationController.doLogin = async function (req, uid) {const loginAsync = util.promisify(req.login).bind(req);const regenerateSession = util.promisify(req.session.regenerate).bind(req.session);+ const sessionData = { ...req.session };await regenerateSession();+ for (const [prop, value] of Object.entries(sessionData)) {+ req.session[prop] = value;+ }+await loginAsync({ uid: uid });await authenticationController.onSuccessfulLogin(req, uid);};