Merge branch 'preprod' into staging

This commit is contained in:
Vins 2024-07-23 16:15:10 +02:00
commit ff10fbd69c

View File

@ -32,6 +32,7 @@ export default class UserController extends ApiController {
protected async getUserInfosFromIdnot(req: Request, response: Response) { protected async getUserInfosFromIdnot(req: Request, response: Response) {
try { try {
const code = req.params["code"]; const code = req.params["code"];
if (!code) throw new Error("code is required"); if (!code) throw new Error("code is required");
const idNotToken = await this.idNotService.getIdNotToken(code); const idNotToken = await this.idNotService.getIdNotToken(code);
@ -62,12 +63,14 @@ export default class UserController extends ApiController {
//Hydrate user to be able to use his contact //Hydrate user to be able to use his contact
const userHydrated = User.hydrate<User>(prismaUser, { strategy: "excludeAll" }); const userHydrated = User.hydrate<User>(prismaUser, { strategy: "excludeAll" });
if (!userHydrated.contact?.email || userHydrated.contact?.email === "") { if (!userHydrated.contact?.email || userHydrated.contact?.email === "") {
this.httpUnauthorized(response, "Email not found"); this.httpUnauthorized(response, "Email not found");
return; return;
} }
let isSubscribed = await this.subscriptionsService.isUserSubscribed(user.uid, userHydrated.office_membership?.uid!); let isSubscribed = await this.subscriptionsService.isUserSubscribed(user.uid, userHydrated.office_membership?.uid!);
//Check if user is whitelisted //Check if user is whitelisted
// const isWhitelisted = await this.whitelistService.getByEmail(userHydrated.contact!.email); // const isWhitelisted = await this.whitelistService.getByEmail(userHydrated.contact!.email);