Skip to content

Commit 54e346a

Browse files
authored
fix(auth): prevent workspace creation on signup with password with no authorized user + fix 10982 (#11128)
Updated the method to properly fetch and return workspace data with related approved access domains. This ensures the correct handling of workspace lookup and fixes potential issues with undefined returns. Fix #10982
1 parent fd23a6e commit 54e346a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

packages/twenty-front/src/modules/settings/components/SettingsListCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export const SettingsListCard = <
8585
description={getItemDescription?.(item)}
8686
rightComponent={<RowRightComponent item={item} />}
8787
divider={index < items.length - 1}
88-
onClick={() => onRowClick?.(item)}
88+
onClick={onRowClick ? () => onRowClick?.(item) : undefined}
8989
to={to?.(item)}
9090
/>
9191
))}

packages/twenty-server/src/engine/core-modules/auth/services/auth.service.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ describe('AuthService', () => {
423423
});
424424

425425
expect(result).toBeUndefined();
426-
expect(spyWorkspaceRepository).toHaveBeenCalledTimes(0);
426+
expect(spyWorkspaceRepository).toHaveBeenCalledTimes(1);
427427
expect(spyAuthSsoService).toHaveBeenCalledTimes(0);
428428
});
429429
it('findWorkspaceForSignInUp - signup password auth with workspaceInviteHash', async () => {

packages/twenty-server/src/engine/core-modules/auth/services/auth.service.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,12 @@ export class AuthService {
562562
);
563563
}
564564

565-
return undefined;
565+
return await this.workspaceRepository.findOne({
566+
where: {
567+
id: params.workspaceId,
568+
},
569+
relations: ['approvedAccessDomains'],
570+
});
566571
}
567572

568573
formatUserDataPayload(

0 commit comments

Comments
 (0)