Merge pull request #1264 from goldquest/develop

fix for multiple cookies support (Also fix for, when session is not valid anymore)
This commit is contained in:
John McLear 2012-12-05 18:12:07 -08:00
commit deb2c54487
1 changed files with 11 additions and 5 deletions

View File

@ -25,7 +25,7 @@ var async = require("async");
var authorManager = require("./AuthorManager"); var authorManager = require("./AuthorManager");
var padManager = require("./PadManager"); var padManager = require("./PadManager");
var sessionManager = require("./SessionManager"); var sessionManager = require("./SessionManager");
var settings = require("../utils/Settings") var settings = require("../utils/Settings");
var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString; var randomString = require('ep_etherpad-lite/static/js/pad_utils').randomString;
/** /**
@ -83,7 +83,7 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback)
// grant access, with author of token // grant access, with author of token
callback(null, statusObject); callback(null, statusObject);
} }
}) });
//don't continue //don't continue
return; return;
@ -133,10 +133,16 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback)
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) {
callback();
return;
}
//is validUntil still ok? //is validUntil still ok?
if(sessionInfo.validUntil <= now) return; if(sessionInfo.validUntil <= now){
callback();
return;
}
// There is a valid session // There is a valid session
validSession = true; validSession = true;
@ -282,4 +288,4 @@ exports.checkAccess = function (padID, sessionCookie, token, password, callback)
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
callback(null, statusObject); callback(null, statusObject);
}); });
} };