Fix user join ban check for users with blank names (but clean IPs)

This commit is contained in:
Calvin Montgomery 2017-03-15 23:44:03 -07:00
parent f6500ff745
commit a594b19745
4 changed files with 143 additions and 5 deletions

View file

@ -59,16 +59,22 @@ KickBanModule.prototype.onUserPreJoin = function (user, data, cb) {
return cb(null, ChannelModule.PASSTHROUGH);
}
var cname = this.channel.name;
checkBan(cname, user.realip, user.getName(), function (banned) {
const cname = this.channel.name;
const check = (user.getName() !== '') ? checkBan : checkIPBan;
function callback(banned) {
if (banned) {
cb(null, ChannelModule.DENY);
user.kick("You are banned from this channel.");
} else {
cb(null, ChannelModule.PASSTHROUGH);
}
});
}
if (user.getName() !== '') {
checkBan(cname, user.realip, user.getName(), callback);
} else {
checkIPBan(cname, user.realip, callback);
}
};
KickBanModule.prototype.onUserPostJoin = function (user) {