mirror of https://github.com/calzoneman/sync.git
Fix passworded room login
This commit is contained in:
parent
d75c8dd230
commit
b6a1e05cd0
|
@ -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;
|
||||
|
|
13
lib/user.js
13
lib/user.js
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue