diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index bbffc9070a..6591459cf2 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -342,7 +342,7 @@ authenticationController.doLogin = async function (req, uid) { await authenticationController.onSuccessfulLogin(req, uid); }; -authenticationController.onSuccessfulLogin = async function (req, uid) { +authenticationController.onSuccessfulLogin = async function (req, uid, trackSession = true) { /* * Older code required that this method be called from within the SSO plugin. * That behaviour is no longer required, onSuccessfulLogin is now automatically @@ -380,7 +380,7 @@ authenticationController.onSuccessfulLogin = async function (req, uid) { new Promise((resolve) => { req.session.save(resolve); }), - user.auth.addSession(uid, req.sessionID), + trackSession ? user.auth.addSession(uid, req.sessionID) : undefined, user.updateLastOnlineTime(uid), user.onUserOnline(uid, Date.now()), analytics.increment('logins'), diff --git a/src/middleware/user.js b/src/middleware/user.js index 3b7c1168db..ca6afcaf9b 100644 --- a/src/middleware/user.js +++ b/src/middleware/user.js @@ -41,7 +41,7 @@ module.exports = function (middleware) { async function finishLogin(req, user) { const loginAsync = util.promisify(req.login).bind(req); await loginAsync(user, { keepSessionInfo: true }); - await controllers.authentication.onSuccessfulLogin(req, user.uid); + await controllers.authentication.onSuccessfulLogin(req, user.uid, false); req.uid = parseInt(user.uid, 10); req.loggedIn = req.uid > 0; return true;