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);