Fix a few minor error conditions

This commit is contained in:
Calvin Montgomery 2018-09-30 21:22:20 -07:00
parent ce44bfea9e
commit 1923af16a9
4 changed files with 9 additions and 4 deletions

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "3.58.2",
"version": "3.58.3",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

View File

@ -338,7 +338,7 @@ Channel.prototype.checkModules = function (fn, args, cb) {
};
args.push(next);
next(null, ChannelModule.PASSTHROUGH);
process.nextTick(next, null, ChannelModule.PASSTHROUGH);
});
};

View File

@ -232,7 +232,7 @@ KickBanModule.prototype.handleCmdBan = function (user, msg, _meta) {
this.banName(user, name, reason).catch(error => {
const message = error.message || error;
user.socket.emit("errorMsg", { msg: message });
}).finally(() => {
}).then(() => {
chan.refCounter.unref("KickBanModule::handleCmdBan");
});
};
@ -264,7 +264,7 @@ KickBanModule.prototype.handleCmdIPBan = function (user, msg, _meta) {
//console.log('!!!', error.stack);
const message = error.message || error;
user.socket.emit("errorMsg", { msg: message });
}).finally(() => {
}).then(() => {
chan.refCounter.unref("KickBanModule::handleCmdIPBan");
});
};

View File

@ -228,6 +228,11 @@ module.exports = {
return;
}
if (!$util.isValidUserName(name)) {
callback(`Invalid username "${name}"`);
return;
}
/* Passwords are capped at 100 characters to prevent a potential
denial of service vector through causing the server to hash
ridiculously long strings.