From 9701ea6301de5e7d5532672f9658e014440a77af Mon Sep 17 00:00:00 2001 From: Vins Date: Tue, 23 Apr 2024 11:05:05 +0200 Subject: [PATCH] fix --- src/app/api/idnot/UserController.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/api/idnot/UserController.ts b/src/app/api/idnot/UserController.ts index 58fd5f64..4135f211 100644 --- a/src/app/api/idnot/UserController.ts +++ b/src/app/api/idnot/UserController.ts @@ -102,11 +102,6 @@ export default class UserController extends ApiController { } } - if (!isSubscribed) { - this.httpUnauthorized(response, "User not subscribed"); - return; - } - //Check if user is whitelisted // const isWhitelisted = await this.whitelistService.getByEmail(userHydrated.contact!.email); @@ -130,7 +125,13 @@ export default class UserController extends ApiController { const manageSubscriptionRules = RulesGroup.hydrateArray(manageSubscriptionRulesEntity, { strategy: "excludeAll" }); if(!manageSubscriptionRules[0]) return; - payload.rules = manageSubscriptionRules[0].rules!.map((rule) => rule.name) || []; + payload.rules = manageSubscriptionRules[0].rules!.map((rule) => rule.name) || []; + isSubscribed = true; + } + + if (!isSubscribed) { + this.httpUnauthorized(response, "User not subscribed"); + return; } const accessToken = this.authService.generateAccessToken(payload);