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.sendUsercount(self.users);
user.once("channelRank", function () {
user.whenChannelRank(function () {
if (!self.registered) {
afterLogin();
return;

View file

@ -16,6 +16,7 @@ function User(socket) {
self.loggingIn = false;
self.rank = -1;
self.global_rank = -1;
self.hasChannelRank = false;
self.channel = null;
self.name = "";
self.canonicalName = "";
@ -94,6 +95,10 @@ function User(socket) {
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) {
var self = this;
self.loggingIn = true;