From 6804a90f2ff203aded76b7870ce6518470d59291 Mon Sep 17 00:00:00 2001 From: Weiko Date: Wed, 17 Apr 2024 15:09:51 +0200 Subject: [PATCH] Fix invite link sign-up with workspace without subcription and billing not enabled (#5006) ## Context We recently introduced this verification but we didn't take into account self-hosting that might not use billing. ## Test tested locally with - new workspace and new account - existing workspace with new account and billing not enabled and status incomplete => OK - existing workspace with new account and billing enabled and status incomplete => NOK - existing workspace with new account and billing enabled and status active => OK --- .../core-modules/auth/services/sign-in-up.service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts index c783cef33..afcddf2c9 100644 --- a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts +++ b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts @@ -132,12 +132,18 @@ export class SignInUpService { }) { const workspace = await this.workspaceRepository.findOneBy({ inviteHash: workspaceInviteHash, - subscriptionStatus: 'active', }); assert( workspace, - 'This workspace inviteHash is invalid or the workspace is not active', + 'This workspace inviteHash is invalid', + ForbiddenException, + ); + + assert( + !this.environmentService.get('IS_BILLING_ENABLED') || + workspace.subscriptionStatus === 'active', + 'Workspace subscription status needs to be active', ForbiddenException, );