AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): bad handling on error prompts (#9754)
Nicholas Tindle2e871b076178
diff --git a/autogpt_platform/frontend/src/app/login/page.tsx b/autogpt_platform/frontend/src/app/login/page.tsxindex 797c8ad85e..629854c4d5 100644--- a/autogpt_platform/frontend/src/app/login/page.tsx+++ b/autogpt_platform/frontend/src/app/login/page.tsx@@ -26,6 +26,7 @@ import {PasswordInput,} from "@/components/auth";import { loginFormSchema } from "@/types/auth";+import { getBehaveAs } from "@/lib/utils";export default function LoginPage() {const { supabase, user, isUserLoading } = useSupabase();@@ -147,7 +148,11 @@ export default function LoginPage() {Login</AuthButton></form>- <AuthFeedback message={feedback} isError={true} />+ <AuthFeedback+ message={feedback}+ isError={!!feedback}+ behaveAs={getBehaveAs()}+ /></Form><AuthBottomTexttext="Don't have an account?"diff --git a/autogpt_platform/frontend/src/app/reset_password/page.tsx b/autogpt_platform/frontend/src/app/reset_password/page.tsxindex a99fc378b0..3c78718a72 100644--- a/autogpt_platform/frontend/src/app/reset_password/page.tsx+++ b/autogpt_platform/frontend/src/app/reset_password/page.tsx@@ -24,6 +24,7 @@ import { useForm } from "react-hook-form";import { z } from "zod";import { changePassword, sendResetEmail } from "./actions";import Spinner from "@/components/Spinner";+import { getBehaveAs } from "@/lib/utils";export default function ResetPasswordPage() {const { supabase, user, isUserLoading } = useSupabase();@@ -151,7 +152,11 @@ export default function ResetPasswordPage() {>Update password</AuthButton>- <AuthFeedback message={feedback} isError={isError} />+ <AuthFeedback+ message={feedback}+ isError={isError}+ behaveAs={getBehaveAs()}+ /></Form></form>) : (@@ -178,7 +183,11 @@ export default function ResetPasswordPage() {>Send reset email</AuthButton>- <AuthFeedback message={feedback} isError={isError} />+ <AuthFeedback+ message={feedback}+ isError={isError}+ behaveAs={getBehaveAs()}+ /></Form></form>)}diff --git a/autogpt_platform/frontend/src/app/signup/page.tsx b/autogpt_platform/frontend/src/app/signup/page.tsxindex 7268f1ff33..10b59b5c9f 100644--- a/autogpt_platform/frontend/src/app/signup/page.tsx+++ b/autogpt_platform/frontend/src/app/signup/page.tsx@@ -36,7 +36,6 @@ export default function SignupPage() {const router = useRouter();const [isLoading, setIsLoading] = useState(false);//TODO: Remove after closed beta- const [showErrorPrompt, setShowErrorPrompt] = useState(false);const form = useForm<z.infer<typeof signupFormSchema>>({resolver: zodResolver(signupFormSchema),@@ -64,13 +63,11 @@ export default function SignupPage() {setFeedback("User with this email already exists");return;} else {- setShowErrorPrompt(true);setFeedback(error);}return;}setFeedback(null);- setShowErrorPrompt(false);},[form],);@@ -193,7 +190,6 @@ export default function SignupPage() {<AuthFeedbackmessage={feedback}isError={!!feedback}- showErrorPrompt={showErrorPrompt}behaveAs={getBehaveAs()}/>diff --git a/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx b/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsxindex 98d808ff8e..835ed118dd 100644--- a/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx+++ b/autogpt_platform/frontend/src/components/auth/AuthFeedback.tsx@@ -7,14 +7,12 @@ import { BehaveAs } from "@/lib/utils";interface Props {message?: string | null;isError?: boolean;- showErrorPrompt?: boolean;behaveAs?: BehaveAs;}export default function AuthFeedback({message = "",isError = false,- showErrorPrompt = false,behaveAs = BehaveAs.CLOUD,}: Props) {// If there's no message but isError is true, show a default error message@@ -41,7 +39,7 @@ export default function AuthFeedback({)}{/* Cloud-specific help */}- {showErrorPrompt && behaveAs === BehaveAs.CLOUD && (+ {isError && behaveAs === BehaveAs.CLOUD && (<div className="mt-2 space-y-2 text-sm"><span className="block text-center font-medium text-red-500">The provided email may not be allowed to sign up.@@ -85,7 +83,7 @@ export default function AuthFeedback({)}{/* Local-specific help */}- {showErrorPrompt && behaveAs === BehaveAs.LOCAL && (+ {isError && behaveAs === BehaveAs.LOCAL && (<Card className="overflow-hidden rounded-lg border border-slate-200 bg-white shadow-sm"><CardContent className="p-0"><div className="space-y-4 divide-y divide-slate-100">