fix(auth): handle missing invitation during sign-up (#9572)
Add validation to throw an exception when a sign-up is attempted without a valid invitation. Updated the test suite to cover this case and ensure proper error handling with appropriate exceptions. Fix https://github.com/twentyhq/twenty/issues/9566 https://github.com/twentyhq/twenty/issues/9564
This commit is contained in:
@ -129,15 +129,16 @@ export class DomainManagerService {
|
||||
return subdomain === this.environmentService.get('DEFAULT_SUBDOMAIN');
|
||||
}
|
||||
|
||||
computeRedirectErrorUrl({
|
||||
errorMessage,
|
||||
subdomain,
|
||||
}: {
|
||||
errorMessage: string;
|
||||
subdomain?: string;
|
||||
}) {
|
||||
const url = this.buildWorkspaceURL({
|
||||
computeRedirectErrorUrl(
|
||||
errorMessage: string,
|
||||
{
|
||||
subdomain,
|
||||
}: {
|
||||
subdomain?: string;
|
||||
},
|
||||
) {
|
||||
const url = this.buildWorkspaceURL({
|
||||
subdomain: subdomain ?? this.environmentService.get('DEFAULT_SUBDOMAIN'),
|
||||
pathname: '/verify',
|
||||
searchParams: { errorMessage },
|
||||
});
|
||||
@ -193,10 +194,12 @@ export class DomainManagerService {
|
||||
|
||||
if (!isDefined(subdomain)) return;
|
||||
|
||||
return await this.workspaceRepository.findOne({
|
||||
where: { subdomain },
|
||||
relations: ['workspaceSSOIdentityProviders'],
|
||||
});
|
||||
return (
|
||||
(await this.workspaceRepository.findOne({
|
||||
where: { subdomain },
|
||||
relations: ['workspaceSSOIdentityProviders'],
|
||||
})) ?? undefined
|
||||
);
|
||||
} catch (e) {
|
||||
throw new WorkspaceException(
|
||||
'Workspace not found',
|
||||
|
||||
Reference in New Issue
Block a user