diff --git a/.replit b/.replit index 76d2fa09..9f5f7a49 100644 --- a/.replit +++ b/.replit @@ -60,6 +60,10 @@ externalPort = 3000 localPort = 40437 externalPort = 3001 +[[ports]] +localPort = 40897 +externalPort = 3002 + [deployment] deploymentTarget = "autoscale" run = ["node", "dist/server/production.mjs"] diff --git a/client/contexts/AuthContext.tsx b/client/contexts/AuthContext.tsx index 502178c9..685f3b12 100644 --- a/client/contexts/AuthContext.tsx +++ b/client/contexts/AuthContext.tsx @@ -533,8 +533,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ // ignore } - // Return user data for caller to use (e.g., Login.tsx) - return { user: data?.user ?? null }; + // Navigation is handled by AuthContext's useEffect watching user state } catch (error: any) { console.error("SignIn error details:", error); @@ -662,7 +661,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ } } - return { emailSent, verificationUrl } as const; + // Navigation is handled by AuthContext's useEffect watching user state } catch (error: any) { aethexToast.error({ title: "Sign up failed", @@ -786,7 +785,7 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ console.log("[Discord Link] Redirecting to Discord OAuth..."); - const u = new URL("/api/discord/oauth/start", apiBase); + const u = new URL("/api/discord/oauth/start", API_BASE); u.searchParams.set( "state", encodeURIComponent( @@ -812,10 +811,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ // For other providers (GitHub, Google), use Supabase's built-in linking try { - const { data, error } = (await supabase.auth.linkIdentity({ + const { data, error } = await (supabase.auth.linkIdentity as any)({ provider, redirectTo: `${window.location.origin}/dashboard?tab=connections`, - })) as any; + }); if (error) throw error; const linkUrl = data?.url; if (linkUrl) { @@ -875,10 +874,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({ return; } try { - const { error } = (await supabase.auth.unlinkIdentity({ + const { error } = await (supabase.auth.unlinkIdentity as any)({ identity_id: identity.identity_id, provider, - })) as any; + }); if (error) throw error; await refreshAuthState(); aethexToast.success({ diff --git a/client/pages/Login.tsx b/client/pages/Login.tsx index 81a0f749..df73395c 100644 --- a/client/pages/Login.tsx +++ b/client/pages/Login.tsx @@ -63,9 +63,6 @@ export default function Login() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [fullName, setFullName] = useState(""); - const [manualVerificationLink, setManualVerificationLink] = useState< - string | null - >(null); const [showReset, setShowReset] = useState(false); const [resetEmail, setResetEmail] = useState(""); const [errorFromUrl, setErrorFromUrl] = useState(null); @@ -169,33 +166,19 @@ export default function Login() { try { if (isSignUp) { - const result = await signUp(email, password, { - data: { - full_name: fullName, - }, + await signUp(email, password, { + full_name: fullName, + }); + toastInfo({ + title: "Account created", + description: "Redirecting to onboarding...", }); - if (result?.user) { - toastInfo({ - title: "Account created", - description: - result?.identities?.length === 0 - ? "Please verify your email to log in" - : "Redirecting to onboarding...", - }); - await aethexUserService.ensureUserProfile(result.user); - navigate("/onboarding", { replace: true }); - } } else { - // Sign in with email/password - const result = await signIn(email, password); - if (result?.user) { - // Don't navigate immediately - let Auth context update and the useEffect below handle redirect - // This ensures profile data is fetched and profileComplete is properly calculated - toastInfo({ - title: "Signing you in", - description: "Redirecting...", - }); - } + await signIn(email, password); + toastInfo({ + title: "Signing you in", + description: "Redirecting...", + }); } } catch (error: any) { console.error("Auth error:", error); @@ -211,7 +194,7 @@ export default function Login() { } }; - const handleSocialLogin = async (provider: string) => { + const handleSocialLogin = async (provider: "github" | "google" | "discord") => { try { await signInWithOAuth(provider); } catch (error) { @@ -289,9 +272,8 @@ export default function Login() { return ( <>
@@ -354,36 +336,6 @@ export default function Login() { {errorFromUrl} ) : null} - {manualVerificationLink ? ( - - - Manual verification required - -

- We couldn't send the verification email automatically. - Use the link below to confirm your account: -

-

- {manualVerificationLink} -

- -
-
- ) : null} {/* Social Login Buttons */}