From 6d70536dad655fd9d715afa639172c8b431cf48c Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:54:13 +0530 Subject: [PATCH] fix: allow all sign in methods when being invited (#13436) * allow all sign in methods * changes * update * add checks --------- Co-authored-by: Keith Williams Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> --- apps/web/pages/auth/sso/[provider].tsx | 5 +- apps/web/pages/signup.tsx | 171 +++++++++++++------------ 2 files changed, 89 insertions(+), 87 deletions(-) diff --git a/apps/web/pages/auth/sso/[provider].tsx b/apps/web/pages/auth/sso/[provider].tsx index 8aa522667f9c8d..5ea01f8dc9b46f 100644 --- a/apps/web/pages/auth/sso/[provider].tsx +++ b/apps/web/pages/auth/sso/[provider].tsx @@ -19,9 +19,8 @@ export default function Provider(props: SSOProviderPageProps) { const router = useRouter(); useEffect(() => { + const email = searchParams?.get("email"); if (props.provider === "saml") { - const email = searchParams?.get("email"); - if (!email) { router.push(`/auth/error?error=Email not provided`); return; @@ -33,6 +32,8 @@ export default function Provider(props: SSOProviderPageProps) { } signIn("saml", {}, { tenant: props.tenant, product: props.product }); + } else if (props.provider === "google" && email) { + signIn("google", {}, { login_hint: email }); } else { signIn(props.provider); } diff --git a/apps/web/pages/signup.tsx b/apps/web/pages/signup.tsx index 49015ba22afc8f..2620efd1757c0e 100644 --- a/apps/web/pages/signup.tsx +++ b/apps/web/pages/signup.tsx @@ -428,8 +428,7 @@ export default function Signup({ : t("create_account")} - {/* Continue with Social Logins - Only for non-invite links */} - {token || (!isGoogleLoginEnabled && !isSAMLLoginEnabled) ? null : ( + {!isGoogleLoginEnabled && !isSAMLLoginEnabled ? null : (
@@ -440,91 +439,93 @@ export default function Signup({
)} - {/* Social Logins - Only for non-invite links*/} - {!token && ( -
- {isGoogleLoginEnabled ? ( - - ) : null} - {isSAMLLoginEnabled ? ( - - ) : null} -
- )} + const url = searchQueryParams.toString() + ? `${GOOGLE_AUTH_URL}?${searchQueryParams.toString()}` + : GOOGLE_AUTH_URL; + + router.push(url); + }}> + Google + + ) : null} + {isSAMLLoginEnabled ? ( + + ) : null} +
{/* Already have an account & T&C */}