fix: session not persisting to database in some scenarios

In some edge cases (e.g. SSO plugin redirecting the user immediately), with modern browsers, the request is never "completed" for speed. This causes a condition where the session object never persists to the database, even though it has changed. This added line forces a db persist on a successful login.

Context: https://github.com/expressjs/session/pull/484
v1.18.x
Julian Lam 4 years ago
parent 504fd107c7
commit 020f0b8322

@ -352,6 +352,7 @@ authenticationController.onSuccessfulLogin = async function (req, uid) {
version: req.useragent.version,
});
await Promise.all([
new Promise(resolve => req.session.save(resolve)),
user.auth.addSession(uid, req.sessionID),
user.updateLastOnlineTime(uid),
user.updateOnlineUsers(uid),

Loading…
Cancel
Save