Skip to content

The open alternative to Salesforce, designed for AI.

Fix invite link sign-up with workspace without subcription and billing not enabled (#5006)

Weiko6804a90f2ff2
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 c783cef338d..afcddf2c902 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,
);