Give client correct authentication status when joining a room. Fixes #166
This commit is contained in:
@@ -25,6 +25,8 @@ class Peer extends EventEmitter
|
||||
|
||||
this._inLobby = false;
|
||||
|
||||
this._authenticated = false;
|
||||
|
||||
this._roles = [ userRoles.ALL ];
|
||||
|
||||
this._displayName = false;
|
||||
@@ -146,6 +148,23 @@ class Peer extends EventEmitter
|
||||
this._inLobby = inLobby;
|
||||
}
|
||||
|
||||
get authenticated()
|
||||
{
|
||||
return this._authenticated;
|
||||
}
|
||||
|
||||
set authenticated(authenticated)
|
||||
{
|
||||
if (authenticated !== this._authenticated)
|
||||
{
|
||||
const oldAuthenticated = this._authenticated;
|
||||
|
||||
this._authenticated = authenticated;
|
||||
|
||||
this.emit('authenticationChanged', { oldAuthenticated });
|
||||
}
|
||||
}
|
||||
|
||||
get roles()
|
||||
{
|
||||
return this._roles;
|
||||
|
||||
+3
-2
@@ -554,8 +554,9 @@ class Room extends EventEmitter
|
||||
.map((joinedPeer) => (joinedPeer.peerInfo));
|
||||
|
||||
cb(null, {
|
||||
roles : peer.roles,
|
||||
peers : peerInfos
|
||||
roles : peer.roles,
|
||||
peers : peerInfos,
|
||||
authenticated : peer.authenticated
|
||||
});
|
||||
|
||||
// Mark the new Peer as joined.
|
||||
|
||||
Reference in New Issue
Block a user