diff --git a/front/src/Components/Menu/AboutRoomSubMenu.svelte b/front/src/Components/Menu/AboutRoomSubMenu.svelte index 16b5c057..2a546a14 100644 --- a/front/src/Components/Menu/AboutRoomSubMenu.svelte +++ b/front/src/Components/Menu/AboutRoomSubMenu.svelte @@ -40,7 +40,9 @@ }) function copyLink() { - HTMLShareLink.select(); + const input: HTMLInputElement = document.getElementById('input-share-link') as HTMLInputElement; + input.focus(); + input.select(); document.execCommand('copy'); } @@ -59,12 +61,12 @@

Share the link of the room !

- +

Share the link of the room !

- +

Information on the map

diff --git a/front/src/Components/Menu/GuestSubMenu.svelte b/front/src/Components/Menu/GuestSubMenu.svelte index 13a7981a..d054ff4d 100644 --- a/front/src/Components/Menu/GuestSubMenu.svelte +++ b/front/src/Components/Menu/GuestSubMenu.svelte @@ -2,7 +2,9 @@ let HTMLShareLink: HTMLInputElement; function copyLink() { - HTMLShareLink.select(); + const input: HTMLInputElement = document.getElementById('input-share-link') as HTMLInputElement; + input.focus(); + input.select(); document.execCommand('copy'); } @@ -22,12 +24,12 @@

Share the link of the room !

- +
diff --git a/front/src/Connexion/ConnectionManager.ts b/front/src/Connexion/ConnectionManager.ts index fbff365c..ffd91d39 100644 --- a/front/src/Connexion/ConnectionManager.ts +++ b/front/src/Connexion/ConnectionManager.ts @@ -226,7 +226,7 @@ class ConnectionManager { public async anonymousLogin(isBenchmark: boolean = false): Promise { const data = await Axios.post(`${PUSHER_URL}/anonymLogin`).then((res) => res.data); - this.localUser = new LocalUser(data.userUuid, []); + this.localUser = new LocalUser(data.userUuid, [], data.email); this.authToken = data.authToken; if (!isBenchmark) { // In benchmark, we don't have a local storage. diff --git a/pusher/src/Controller/AuthenticateController.ts b/pusher/src/Controller/AuthenticateController.ts index 5e4eb19f..fb428141 100644 --- a/pusher/src/Controller/AuthenticateController.ts +++ b/pusher/src/Controller/AuthenticateController.ts @@ -63,25 +63,30 @@ export class AuthenticateController extends BaseController { if (token != undefined) { try { const authTokenData: AuthTokenData = jwtTokenManager.verifyJWTToken(token as string, false); + + //Get user data from Admin Back Office + //This is very important to create User Local in LocalStorage in WorkAdventure + const resUserData = await this.getUserByUserIdentifier( + authTokenData.identifier, + playUri as string, + IPAddress + ); + if (authTokenData.accessToken == undefined) { //if not nonce and code, user connected in anonymous //get data with identifier and return token if (!code && !nonce) { - const data = await this.getUserByUserIdentifier( - authTokenData.identifier, - playUri as string, - IPAddress - ); res.writeStatus("200"); this.addCorsHeaders(res); - return res.end(JSON.stringify({ ...data, authToken: token })); + return res.end(JSON.stringify({ ...resUserData, authToken: token })); } throw Error("Token cannot to be check on Hydra"); } + const resCheckTokenAuth = await openIDClient.checkTokenAuth(authTokenData.accessToken); res.writeStatus("200"); this.addCorsHeaders(res); - return res.end(JSON.stringify({ ...resCheckTokenAuth, authToken: token })); + return res.end(JSON.stringify({ ...resCheckTokenAuth, ...resUserData, authToken: token })); } catch (err) { console.info("User was not connected", err); } @@ -261,7 +266,14 @@ export class AuthenticateController extends BaseController { playUri: string, IPAddress: string ): Promise { - let data: FetchMemberDataByUuidResponse | object = {}; + let data: FetchMemberDataByUuidResponse = { + email: email, + userUuid: email, + tags: [], + messages: [], + visitCardUrl: null, + textures: [], + }; try { data = await adminApi.fetchMemberDataByUuid(email, playUri, IPAddress); } catch (err) { diff --git a/pusher/src/Controller/IoSocketController.ts b/pusher/src/Controller/IoSocketController.ts index 9b6c1510..35fd08d5 100644 --- a/pusher/src/Controller/IoSocketController.ts +++ b/pusher/src/Controller/IoSocketController.ts @@ -189,6 +189,7 @@ export class IoSocketController { let memberTextures: CharacterTexture[] = []; const room = await socketManager.getOrCreateRoom(roomId); let userData: FetchMemberDataByUuidResponse = { + email: userIdentifier, userUuid: userIdentifier, tags: [], visitCardUrl: null, diff --git a/pusher/src/Services/AdminApi.ts b/pusher/src/Services/AdminApi.ts index 6e1848eb..416b9cb6 100644 --- a/pusher/src/Services/AdminApi.ts +++ b/pusher/src/Services/AdminApi.ts @@ -22,6 +22,7 @@ export interface AdminBannedData { } export interface FetchMemberDataByUuidResponse { + email: string; userUuid: string; tags: string[]; visitCardUrl: string | null;