Merge pull request #1687 from thecodingmachine/fix-register

Remove policy from API data
This commit is contained in:
Alexis Faizeau 2021-12-30 13:08:24 +01:00 committed by GitHub
commit b929a62548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 20 deletions

View File

@ -104,6 +104,10 @@ export class Room {
const data = result.data; const data = result.data;
if (data.authenticationMandatory !== undefined) {
data.authenticationMandatory = Boolean(data.authenticationMandatory);
}
if (isRoomRedirect(data)) { if (isRoomRedirect(data)) {
return { return {
redirectUrl: data.redirectUrl, redirectUrl: data.redirectUrl,

View File

@ -8,12 +8,10 @@ import { isCharacterTexture } from "./CharacterTexture";
export const isAdminApiData = new tg.IsInterface() export const isAdminApiData = new tg.IsInterface()
.withProperties({ .withProperties({
roomUrl: tg.isString,
email: tg.isNullable(tg.isString),
mapUrlStart: tg.isString,
tags: tg.isArray(tg.isString),
policy_type: tg.isNumber,
userUuid: tg.isString, userUuid: tg.isString,
email: tg.isNullable(tg.isString),
roomUrl: tg.isString,
mapUrlStart: tg.isString,
textures: tg.isArray(isCharacterTexture), textures: tg.isArray(isCharacterTexture),
}) })
.withOptionalProperties({ .withOptionalProperties({

View File

@ -75,21 +75,6 @@ class AdminApi {
return res.data; return res.data;
} }
async fetchCheckUserByToken(organizationMemberToken: string): Promise<AdminApiData> {
if (!ADMIN_API_URL) {
return Promise.reject(new Error("No admin backoffice set!"));
}
//todo: this call can fail if the corresponding world is not activated or if the token is invalid. Handle that case.
const res = await Axios.get(ADMIN_API_URL + "/api/check-user/" + organizationMemberToken, {
headers: { Authorization: `${ADMIN_API_TOKEN}` },
});
if (!isAdminApiData(res.data)) {
console.error("Message received from /api/check-user is not in the expected format. Message: ", res.data);
throw new Error("Message received from /api/check-user is not in the expected format.");
}
return res.data;
}
reportPlayer( reportPlayer(
reportedUserUuid: string, reportedUserUuid: string,
reportedUserComment: string, reportedUserComment: string,