Skip to content

The open alternative to Salesforce, designed for AI.

refactor(auth): optimize work email handling in sign-up flow (#11655)

Antoine Moreaux83434deb2293
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 beb6715b39e..5c63f1df72e 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
@@ -352,11 +352,14 @@ export class SignInUpService {
}
};
+ const isWorkEmailFound = isWorkEmail(email);
const logo =
- isWorkEmail(email) && (await isLogoUrlValid()) ? logoUrl : undefined;
+ isWorkEmailFound && (await isLogoUrlValid()) ? logoUrl : undefined;
const workspaceToCreate = this.workspaceRepository.create({
- subdomain: await this.domainManagerService.generateSubdomain(),
+ subdomain: await this.domainManagerService.generateSubdomain(
+ isWorkEmailFound ? { email } : {},
+ ),
displayName: '',
inviteHash: v4(),
activationStatus: WorkspaceActivationStatus.PENDING_CREATION,