Skip to content

The open alternative to Salesforce, designed for AI.

fix(auth): prevent workspace creation on signup with password with no authorized user + fix 10982 (#11128)

Antoine Moreaux54e346a2aa0d
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx b/packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx
index c40f35f39d0..a93304e0ca4 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx
@@ -85,7 +85,7 @@ export const SettingsListCard = <
description={getItemDescription?.(item)}
rightComponent={<RowRightComponent item={item} />}
divider={index < items.length - 1}
- onClick={() => onRowClick?.(item)}
+ onClick={onRowClick ? () => onRowClick?.(item) : undefined}
to={to?.(item)}
/>
))}
diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts
index d794fa4344c..c18b794aeae 100644
--- a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts
+++ b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts
@@ -423,7 +423,7 @@ describe('AuthService', () => {
});
expect(result).toBeUndefined();
- expect(spyWorkspaceRepository).toHaveBeenCalledTimes(0);
+ expect(spyWorkspaceRepository).toHaveBeenCalledTimes(1);
expect(spyAuthSsoService).toHaveBeenCalledTimes(0);
});
it('findWorkspaceForSignInUp - signup password auth with workspaceInviteHash', async () => {
diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
index 2189782c9e9..af12da975c0 100644
--- a/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts
@@ -562,7 +562,12 @@ export class AuthService {
);
}
- return undefined;
+ return await this.workspaceRepository.findOne({
+ where: {
+ id: params.workspaceId,
+ },
+ relations: ['approvedAccessDomains'],
+ });
}
formatUserDataPayload(