添加 - isMaster 添加登录检查

This commit is contained in:
suwings 2018-04-21 15:20:55 +08:00
parent 7e1977a343
commit 8b8bf636be

View File

@ -27,7 +27,7 @@ module.exports.randomString = randomString;
module.exports.needLogin = (req, res, trueCallBack, falseCallBack) => {
let username = req.session['username'];
if (req.session['login'] && loginedContainer.isLogined(req.sessionID)) {
if (req.session['login'] && loginedContainer.isLogined(req.sessionID, username)) {
if (req.session['login'] === true && username) {
trueCallBack && trueCallBack();
return true;
@ -43,6 +43,9 @@ module.exports.isMaster = (wsSession, notPermssionCounter) => {
if (!wsSession.username || typeof wsSession.username != 'string') {
return false;
}
if (!loginedContainer.isLogined(wsSession.sessionID, wsSession.username)) {
return false;
}
let username = wsSession.username.trim() || '';
if (username) {
if (username.substr(0, 1) == '#') {