Skip to content

Commit

Permalink
refactor(auth): update SSO provider selection logic (#9975)
Browse files Browse the repository at this point in the history
Refined the logic to check for SSO providers before setting the sign-in
step. Consolidated conditions to ensure clarity and avoid redundant
checks.
  • Loading branch information
AMoreaux authored Feb 3, 2025
1 parent 5a13d5a commit eb0762d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export const SignInUpWorkspaceScopeFormEffect = () => {
return;
}

if (workspaceAuthProviders.sso.length > 1) {
return setSignInUpStep(SignInUpStep.SSOIdentityProviderSelection);
}

const hasOnlySSOProvidersEnabled =
!workspaceAuthProviders.google &&
!workspaceAuthProviders.microsoft &&
!workspaceAuthProviders.password;

if (hasOnlySSOProvidersEnabled && workspaceAuthProviders.sso.length > 1) {
return setSignInUpStep(SignInUpStep.SSOIdentityProviderSelection);
}

if (hasOnlySSOProvidersEnabled && workspaceAuthProviders.sso.length === 1) {
redirectToSSOLoginPage(workspaceAuthProviders.sso[0].id);
}
Expand Down

0 comments on commit eb0762d

Please sign in to comment.