Revert "Fixed foreach loop on session IDs, was breaking EP on single session in cookie."
This reverts commit 443a71bc9c
.
modified: src/node/db/SecurityManager.js
pull/1015/head
parent
0883043eb9
commit
b9da0e187e
|
@ -123,29 +123,26 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
var sessionIDs = sessionCookie.split(',');
|
var sessionIDs = sessionCookie.split(',');
|
||||||
if (sessionIDs){
|
async.foreach(sessionIDs, function(sessionID) {
|
||||||
async.forEach(sessionIDs, function(sessionID, cb){
|
sessionManager.getSessionInfo(sessionID, function(err, sessionInfo) {
|
||||||
sessionManager.getSessionInfo(sessionID, function(err, sessionInfo) {
|
//skip session if it doesn't exist
|
||||||
//skip session if it doesn't exist
|
if(err && err.message == "sessionID does not exist") return;
|
||||||
if(err && err.message == "sessionID does not exist") return;
|
|
||||||
|
|
||||||
if(ERR(err, callback)) return;
|
if(ERR(err, callback)) return;
|
||||||
|
|
||||||
var now = Math.floor(new Date().getTime()/1000);
|
var now = Math.floor(new Date().getTime()/1000);
|
||||||
|
|
||||||
//is it for this group?
|
//is it for this group?
|
||||||
if(sessionInfo.groupID != groupID) return;
|
if(sessionInfo.groupID != groupID) return;
|
||||||
|
|
||||||
//is validUntil still ok?
|
//is validUntil still ok?
|
||||||
if(sessionInfo.validUntil <= now) return;
|
if(sessionInfo.validUntil <= now) return;
|
||||||
|
|
||||||
// There is a valid session
|
// There is a valid session
|
||||||
validSession = true;
|
validSession = true;
|
||||||
sessionAuthor = sessionInfo.authorID;
|
sessionAuthor = sessionInfo.authorID;
|
||||||
cb(); // finish the current value and go to next
|
});
|
||||||
});
|
}, callback)
|
||||||
}, callback)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
//get author for token
|
//get author for token
|
||||||
function(callback)
|
function(callback)
|
||||||
|
|
Loading…
Reference in New Issue