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 ? (
-
+
+ {isGoogleLoginEnabled ? (
+
+ }
+ className={classNames(
+ "w-full justify-center rounded-md text-center",
+ formMethods.formState.errors.username ? "opacity-50" : ""
+ )}
+ onClick={async () => {
+ setIsGoogleLoading(true);
+ const username = formMethods.getValues("username");
+ const baseUrl = process.env.NEXT_PUBLIC_WEBAPP_URL;
+ const GOOGLE_AUTH_URL = `${baseUrl}/auth/sso/google`;
+ const searchQueryParams = new URLSearchParams();
+ if (username) {
+ // If username is present we save it in query params to check for premium
+ searchQueryParams.set("username", username);
+ localStorage.setItem("username", username);
}
- className={classNames(
- "w-full justify-center rounded-md text-center",
- formMethods.formState.errors.username ? "opacity-50" : ""
- )}
- onClick={async () => {
- setIsGoogleLoading(true);
- const username = formMethods.getValues("username");
- const baseUrl = process.env.NEXT_PUBLIC_WEBAPP_URL;
- const GOOGLE_AUTH_URL = `${baseUrl}/auth/sso/google`;
- if (username) {
- // If username is present we save it in query params to check for premium
- const searchQueryParams = new URLSearchParams();
- searchQueryParams.set("username", username);
- localStorage.setItem("username", username);
- router.push(`${GOOGLE_AUTH_URL}?${searchQueryParams.toString()}`);
- return;
- }
- router.push(GOOGLE_AUTH_URL);
- }}>
- Google
-
- ) : 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 */}