Merge branch 'develop' of github.com:thecodingmachine/workadventure

This commit is contained in:
_Bastler 2021-09-20 08:55:41 +02:00
commit ccafaf11e3
3 changed files with 15 additions and 9 deletions

View File

@ -23,4 +23,4 @@ RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule "^[_@]/" "/index.html" [L]
RewriteRule "^register/" "/index.html" [L]
RewriteRule "^login" "/index.html" [L]
RewriteRule "^jwt/" "/index.html" [L]
RewriteRule "^jwt" "/index.html" [L]

View File

@ -81,8 +81,10 @@ class ConnectionManager {
this._currentRoom = null;
if (connexionType === GameConnexionTypes.login) {
this._currentRoom = await Room.createRoom(new URL(localUserStore.getLastRoomUrl()));
this.loadOpenIDScreen();
return Promise.reject(new Error("You will be redirect on login page"));
if (this.loadOpenIDScreen() !== null) {
return Promise.reject(new Error("You will be redirect on login page"));
}
urlManager.pushRoomIdToUrl(this._currentRoom);
} else if (connexionType === GameConnexionTypes.jwt) {
const urlParams = new URLSearchParams(window.location.search);
const code = urlParams.get("code");
@ -191,7 +193,7 @@ class ConnectionManager {
return Promise.reject(new Error("Invalid URL"));
}
if (this.localUser) {
analyticsClient.identifyUser(this.localUser.uuid)
analyticsClient.identifyUser(this.localUser.uuid);
}
this.serviceWorker = new _ServiceWorker();

View File

@ -30,12 +30,12 @@ export class AuthenticateController extends BaseController {
console.warn("/message request was aborted");
});
const { nonce, state, playUri } = parse(req.getQuery());
if (!state || !nonce) {
res.writeStatus("400 Unauthorized").end("missing state and nonce URL parameters");
return;
}
try {
const { nonce, state, playUri } = parse(req.getQuery());
if (!state || !nonce) {
throw "missing state and nonce URL parameters";
}
const loginUri = await openIDClient.authorizationUrl(
state as string,
nonce as string,
@ -45,6 +45,7 @@ export class AuthenticateController extends BaseController {
res.writeHeader("Location", loginUri);
return res.end();
} catch (e) {
console.error("openIDLogin => e", e);
return this.errorToResponse(e, res);
}
});
@ -85,6 +86,7 @@ export class AuthenticateController extends BaseController {
this.addCorsHeaders(res);
return res.end(JSON.stringify({ authToken: authToken, username: userInfo.username, userUuid : sub }));
} catch (e) {
console.error("openIDCallback => ERROR", e);
return this.errorToResponse(e, res);
}
});
@ -155,6 +157,7 @@ export class AuthenticateController extends BaseController {
})
);
} catch (e) {
console.error("register => ERROR", e);
this.errorToResponse(e, res);
}
})();
@ -231,6 +234,7 @@ export class AuthenticateController extends BaseController {
}
}
} catch (error) {
console.error("profileCallback => ERROR", error);
this.errorToResponse(error, res);
}
});