refactor(auth): optimize work email handling in sign-up flow (#11655)
Extracted isWorkEmail check into a variable for reusability and adjusted subdomain generation to conditionally include email. This enhances code readability and maintains logic consistency.
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user