refactor(auth): update SSO provider selection logic (#9975)

Refined the logic to check for SSO providers before setting the sign-in
step. Consolidated conditions to ensure clarity and avoid redundant
checks.
This commit is contained in:
Antoine Moreaux
2025-02-03 15:12:56 +01:00
committed by GitHub
parent 5a13d5ae29
commit eb0762dc58

View File

@ -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);
}