From eb0762dc58216d71d10bb81732deb472f0cc15d5 Mon Sep 17 00:00:00 2001 From: Antoine Moreaux Date: Mon, 3 Feb 2025 15:12:56 +0100 Subject: [PATCH] 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. --- .../components/SignInUpWorkspaceScopeFormEffect.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpWorkspaceScopeFormEffect.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpWorkspaceScopeFormEffect.tsx index 6d3b0239c..8811127f9 100644 --- a/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpWorkspaceScopeFormEffect.tsx +++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/SignInUpWorkspaceScopeFormEffect.tsx @@ -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); }