Disallow duplicate guest names

This commit is contained in:
Calvin Montgomery 2013-07-02 23:24:03 -04:00
parent 6a6dd7bc21
commit beb26f45fb
1 changed files with 11 additions and 0 deletions

11
user.js
View File

@ -574,6 +574,17 @@ User.prototype.login = function(name, pw, session) {
}); });
} }
else { 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(); lastguestlogin[this.ip] = Date.now();
this.rank = Rank.Guest; this.rank = Rank.Guest;
Logger.syslog.log(this.ip + " signed in as " + name); Logger.syslog.log(this.ip + " signed in as " + name);