From 067d2e0bf522c28400040109b1acc2c94825b63f Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Thu, 13 Nov 2025 03:42:40 +0000 Subject: [PATCH] completionId: cgen-9afabb5cf35141549055f29c2fabec02 cgen-9afabb5cf35141549055f29c2fabec02 --- client/pages/StaffLogin.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/client/pages/StaffLogin.tsx b/client/pages/StaffLogin.tsx index 54cd0b9e..629c9794 100644 --- a/client/pages/StaffLogin.tsx +++ b/client/pages/StaffLogin.tsx @@ -17,18 +17,27 @@ export default function StaffLogin() { const [isSigningIn, setIsSigningIn] = useState(false); const [error, setError] = useState(null); - // Redirect if already authenticated and has @aethex.dev email + // Redirect if already authenticated and has @aethex.dev email (primary or linked) useEffect(() => { if (!loading && user && profile) { const email = user.email || profile.email || ""; - if (email.endsWith("@aethex.dev")) { + const hasDevEmail = + email.endsWith("@aethex.dev") || + (profile as any)?.is_dev_account || + user.identities?.some((identity: any) => + identity.identity_data?.email?.endsWith("@aethex.dev"), + ); + + if (hasDevEmail) { toastInfo({ title: "Already logged in", description: "Redirecting to staff dashboard...", }); navigate("/staff/dashboard", { replace: true }); } else { - setError("Only @aethex.dev email addresses are allowed"); + setError( + "Only @aethex.dev email addresses (or linked accounts) are allowed", + ); } } }, [user, profile, loading, navigate, toastInfo]);