Skip to content

Commit

Permalink
fix: #9487, session data gathered during a session is lost upon login
Browse files Browse the repository at this point in the history
e.g. returnTo, tids_viewed, etc.
  • Loading branch information
julianlam committed Apr 14, 2021
1 parent f4c5050 commit 1fee6a7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/controllers/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit 1fee6a7

Please sign in to comment.