Fix IP hiding causing ban issues

This commit is contained in:
Calvin Montgomery 2013-06-09 23:57:48 +04:00
parent 40d0bdf120
commit 9703086c7c
1 changed files with 1 additions and 8 deletions

View File

@ -402,7 +402,7 @@ Channel.prototype.tryIPBan = function(actor, data) {
if(!this.hasPermission(actor, "ban")) { if(!this.hasPermission(actor, "ban")) {
return false; return false;
} }
if(typeof data.id != "string" || data.id.length != 15) { if(typeof data.id != "string") {
return false; return false;
} }
if(typeof data.name != "string") { if(typeof data.name != "string") {
@ -635,16 +635,9 @@ Channel.prototype.kick = function(user, reason) {
} }
Channel.prototype.hideIP = function(ip) { Channel.prototype.hideIP = function(ip) {
while(ip.length < 15) {
ip += "X";
}
var chars = new Array(15); var chars = new Array(15);
for(var i = 0; i < ip.length; i++) { for(var i = 0; i < ip.length; i++) {
chars[i] = String.fromCharCode(ip.charCodeAt(i) ^ this.ipkey.charCodeAt(i)); chars[i] = String.fromCharCode(ip.charCodeAt(i) ^ this.ipkey.charCodeAt(i));
if(chars[i] == "X") {
chars[i] = "";
break;
}
} }
return chars.join(""); return chars.join("");
} }