mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
test: dont track session for api/v3 (#12660)
since they get destroyed when the request ends
This commit is contained in:
committed by
GitHub
parent
d6c946cf14
commit
61e5293a76
@@ -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'),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user