Disallow duplicate guest names

This commit is contained in:
Calvin Montgomery 2013-07-02 23:24:03 -04:00
parent 6a6dd7bc21
commit beb26f45fb

11
user.js
View file

@ -574,6 +574,17 @@ User.prototype.login = function(name, pw, session) {
});
}
else {
if(this.channel != null) {
for(var i = 0; i < this.channel.users.length; i++) {
if(this.channel.users[i].name == name) {
this.socket.emit("login", {
success: false,
error: "That name is already taken on this channel"
});
return;
}
}
}
lastguestlogin[this.ip] = Date.now();
this.rank = Rank.Guest;
Logger.syslog.log(this.ip + " signed in as " + name);