Skip to content

Commit

Permalink
fix(auth, workspace-invitation): enforce required subdomains (#9464)
Browse files Browse the repository at this point in the history
Updated the handling of `targetWorkspaceSubdomain` and `subdomain` to
enforce them as required fields. This prevents potential issues caused
by missing values during sign-in/up and workspace invitation processes.
  • Loading branch information
AMoreaux authored Jan 8, 2025
1 parent bc30c69 commit d61409a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ describe('SignInUpService', () => {
email,
password,
fromSSO: false,
targetWorkspaceSubdomain: 'testSubDomain',
workspaceInviteHash,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,21 @@ export class SignInUpService {
}
}

const signInUpWithInvitationResult = await this.signInUpWithInvitation({
email,
workspacePersonalInviteToken,
workspaceInviteHash,
targetWorkspaceSubdomain,
fromSSO,
firstName,
lastName,
picture,
authProvider,
passwordHash,
existingUser,
});
const signInUpWithInvitationResult = targetWorkspaceSubdomain
? await this.signInUpWithInvitation({
email,
workspacePersonalInviteToken,
workspaceInviteHash,
targetWorkspaceSubdomain,
fromSSO,
firstName,
lastName,
picture,
authProvider,
passwordHash,
existingUser,
})
: undefined;

if (isDefined(signInUpWithInvitationResult)) {
return signInUpWithInvitationResult;
Expand Down Expand Up @@ -187,7 +189,7 @@ export class SignInUpService {
passwordHash?: string;
existingUser: User | null;
fromSSO: boolean;
targetWorkspaceSubdomain?: string;
targetWorkspaceSubdomain: string;
}) {
const maybeInvitation =
fromSSO && !workspacePersonalInviteToken && !workspaceInviteHash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class WorkspaceInvitationService {
subdomain,
email,
}: {
subdomain?: string;
subdomain: string;
email: string;
}) {
const workspace =
Expand Down

0 comments on commit d61409a

Please sign in to comment.