HotFix mandatory login with ADMIN openid connexion (#1503)
Before anonymous connexion, we must get the details of the map and permit to check mandatory connexion and redirect user to login page. Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
parent
b33e271d2e
commit
908b78fdda
2 changed files with 15 additions and 12 deletions
|
@ -137,17 +137,6 @@ class ConnectionManager {
|
||||||
connexionType === GameConnexionTypes.empty
|
connexionType === GameConnexionTypes.empty
|
||||||
) {
|
) {
|
||||||
this.authToken = localUserStore.getAuthToken();
|
this.authToken = localUserStore.getAuthToken();
|
||||||
//todo: add here some kind of warning if authToken has expired.
|
|
||||||
if (!this.authToken) {
|
|
||||||
await this.anonymousLogin();
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
await this.checkAuthUserConnexion();
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.localUser = localUserStore.getLocalUser() as LocalUser; //if authToken exist in localStorage then localUser cannot be null
|
|
||||||
|
|
||||||
let roomPath: string;
|
let roomPath: string;
|
||||||
if (connexionType === GameConnexionTypes.empty) {
|
if (connexionType === GameConnexionTypes.empty) {
|
||||||
|
@ -172,7 +161,21 @@ class ConnectionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
//get detail map for anonymous login and set texture in local storage
|
//get detail map for anonymous login and set texture in local storage
|
||||||
|
//before set token of user we must load room and all information. For example the mandatory authentication could be require on current room
|
||||||
this._currentRoom = await Room.createRoom(new URL(roomPath));
|
this._currentRoom = await Room.createRoom(new URL(roomPath));
|
||||||
|
|
||||||
|
//todo: add here some kind of warning if authToken has expired.
|
||||||
|
if (!this.authToken && !this._currentRoom.authenticationMandatory) {
|
||||||
|
await this.anonymousLogin();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
await this.checkAuthUserConnexion();
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.localUser = localUserStore.getLocalUser() as LocalUser; //if authToken exist in localStorage then localUser cannot be null
|
||||||
|
|
||||||
if (this._currentRoom.textures != undefined && this._currentRoom.textures.length > 0) {
|
if (this._currentRoom.textures != undefined && this._currentRoom.textures.length > 0) {
|
||||||
//check if texture was changed
|
//check if texture was changed
|
||||||
if (this.localUser.textures.length === 0) {
|
if (this.localUser.textures.length === 0) {
|
||||||
|
|
|
@ -25,7 +25,7 @@ export class LoginScene extends ResizableScene {
|
||||||
if (
|
if (
|
||||||
localUserStore.getAuthToken() == undefined &&
|
localUserStore.getAuthToken() == undefined &&
|
||||||
gameManager.currentStartedRoom &&
|
gameManager.currentStartedRoom &&
|
||||||
gameManager.currentStartedRoom?.authenticationMandatory
|
gameManager.currentStartedRoom.authenticationMandatory
|
||||||
) {
|
) {
|
||||||
connectionManager.loadOpenIDScreen();
|
connectionManager.loadOpenIDScreen();
|
||||||
loginSceneVisibleIframeStore.set(true);
|
loginSceneVisibleIframeStore.set(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue