mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
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
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user