Fix passworded room login

This commit is contained in:
calzoneman 2014-02-28 09:21:28 -06:00
parent d75c8dd230
commit b6a1e05cd0
2 changed files with 14 additions and 1 deletions

View File

@ -556,7 +556,7 @@ Channel.prototype.join = function (user) {
self.sendVoteskipUpdate(self.users); self.sendVoteskipUpdate(self.users);
self.sendUsercount(self.users); self.sendUsercount(self.users);
user.once("channelRank", function () { user.whenChannelRank(function () {
if (!self.registered) { if (!self.registered) {
afterLogin(); afterLogin();
return; return;

View File

@ -16,6 +16,7 @@ function User(socket) {
self.loggingIn = false; self.loggingIn = false;
self.rank = -1; self.rank = -1;
self.global_rank = -1; self.global_rank = -1;
self.hasChannelRank = false;
self.channel = null; self.channel = null;
self.name = ""; self.name = "";
self.canonicalName = ""; self.canonicalName = "";
@ -94,6 +95,10 @@ function User(socket) {
self.initAdminCallbacks(); self.initAdminCallbacks();
} }
}); });
self.once("channelRank", function () {
self.hasChannelRank = true;
});
} }
/** /**
@ -474,6 +479,14 @@ User.prototype.whenLoggedIn = function (fn) {
} }
}; };
User.prototype.whenChannelRank = function (fn) {
if (this.hasChannelRank) {
fn();
} else {
this.once("channelRank", fn);
}
};
User.prototype.login = function (name, pw) { User.prototype.login = function (name, pw) {
var self = this; var self = this;
self.loggingIn = true; self.loggingIn = true;