Fail /kick, /ban if the target name is blank

This commit is contained in:
calzoneman 2014-08-18 22:00:51 -05:00
parent aff20c3012
commit c2ba55ac0f

View file

@ -154,7 +154,7 @@ KickBanModule.prototype.handleCmdKick = function (user, msg, meta) {
var args = msg.split(" ");
args.shift(); /* shift off /kick */
if (args.length === 0) {
if (args.length === 0 || args[0].trim() === "") {
return user.socket.emit("errorMsg", {
msg: "No kick target specified. If you're trying to kick " +
"anonymous users, use /kickanons"
@ -213,7 +213,7 @@ KickBanModule.prototype.handleCmdKickAnons = function (user, msg, meta) {
KickBanModule.prototype.handleCmdBan = function (user, msg, meta) {
var args = msg.split(" ");
args.shift(); /* shift off /ban */
if (args.length === 0) {
if (args.length === 0 || args[0].trim() === "") {
return user.socket.emit("errorMsg", {
msg: "No ban target specified."
});
@ -232,7 +232,7 @@ KickBanModule.prototype.handleCmdBan = function (user, msg, meta) {
KickBanModule.prototype.handleCmdIPBan = function (user, msg, meta) {
var args = msg.split(" ");
args.shift(); /* shift off /ipban */
if (args.length === 0) {
if (args.length === 0 || args[0].trim() === "") {
return user.socket.emit("errorMsg", {
msg: "No ban target specified."
});