diff --git a/surfsense_web/app/(home)/login/GoogleLoginButton.tsx b/surfsense_web/app/(home)/login/GoogleLoginButton.tsx index e22fc2798..581bfe17f 100644 --- a/surfsense_web/app/(home)/login/GoogleLoginButton.tsx +++ b/surfsense_web/app/(home)/login/GoogleLoginButton.tsx @@ -1,15 +1,47 @@ "use client"; -import { IconBrandGoogleFilled } from "@tabler/icons-react"; -import { motion } from "motion/react"; import { useTranslations } from "next-intl"; +import { useState } from "react"; import { Logo } from "@/components/Logo"; +import { Button } from "@/components/ui/button"; import { trackLoginAttempt } from "@/lib/posthog/events"; import { AmbientBackground } from "./AmbientBackground"; +function GoogleGLogo({ className }: { className?: string }) { + return ( + + ); +} + export function GoogleLoginButton() { const t = useTranslations("auth"); + const [isRedirecting, setIsRedirecting] = useState(false); const handleGoogleLogin = () => { + if (isRedirecting) return; + setIsRedirecting(true); + // Track Google login attempt trackLoginAttempt("google"); @@ -73,21 +105,15 @@ export function GoogleLoginButton() { */} - -
-
-
-
-
-
- + {t("continue_with_google")} -
+ ); diff --git a/surfsense_web/app/desktop/login/page.tsx b/surfsense_web/app/desktop/login/page.tsx index 765ff8276..41c956f3e 100644 --- a/surfsense_web/app/desktop/login/page.tsx +++ b/surfsense_web/app/desktop/login/page.tsx @@ -195,6 +195,7 @@ export default function DesktopLoginPage() { const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [loginError, setLoginError] = useState(null); + const [isGoogleRedirecting, setIsGoogleRedirecting] = useState(false); const [shortcuts, setShortcuts] = useState(DEFAULT_SHORTCUTS); const [shortcutsLoaded, setShortcutsLoaded] = useState(false); @@ -236,6 +237,8 @@ export default function DesktopLoginPage() { ); const handleGoogleLogin = () => { + if (isGoogleRedirecting) return; + setIsGoogleRedirecting(true); window.location.href = `${BACKEND_URL}/auth/google/authorize-redirect`; }; @@ -344,6 +347,7 @@ export default function DesktopLoginPage() { ); } diff --git a/surfsense_web/components/homepage/hero-section.tsx b/surfsense_web/components/homepage/hero-section.tsx index 2630f4266..c0abd927f 100644 --- a/surfsense_web/components/homepage/hero-section.tsx +++ b/surfsense_web/components/homepage/hero-section.tsx @@ -177,8 +177,11 @@ export function HeroSection() { function GetStartedButton() { const isGoogleAuth = AUTH_TYPE === "GOOGLE"; + const [isRedirecting, setIsRedirecting] = useState(false); const handleGoogleLogin = () => { + if (isRedirecting) return; + setIsRedirecting(true); trackLoginAttempt("google"); window.location.href = `${BACKEND_URL}/auth/google/authorize-redirect`; }; @@ -189,7 +192,8 @@ function GetStartedButton() { type="button" variant="ghost" onClick={handleGoogleLogin} - className="h-14 w-full cursor-pointer gap-3 rounded-lg bg-white text-center text-base font-medium text-neutral-700 shadow-sm ring-1 shadow-black/10 ring-black/10 transition duration-150 active:scale-98 hover:bg-neutral-50 sm:w-56 dark:bg-neutral-900 dark:text-neutral-200 dark:ring-neutral-700/50 dark:hover:bg-neutral-800" + disabled={isRedirecting} + className="h-14 w-full cursor-pointer gap-3 rounded-lg border border-white bg-white text-center text-base font-medium text-[#1f1f1f] shadow-sm transition duration-150 hover:bg-zinc-100 hover:text-[#1f1f1f] sm:w-56 dark:border-white" > Continue with Google