From 268734dfad2ac7bb431b7b07e60814bac5788266 Mon Sep 17 00:00:00 2001 From: makearmy Date: Tue, 30 Sep 2025 22:18:15 -0400 Subject: [PATCH] registration bug fixes --- app/auth/sign-up/sign-up.tsx | 64 ++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/app/auth/sign-up/sign-up.tsx b/app/auth/sign-up/sign-up.tsx index 76137a96..a753bab5 100644 --- a/app/auth/sign-up/sign-up.tsx +++ b/app/auth/sign-up/sign-up.tsx @@ -9,7 +9,7 @@ type Props = { nextPath?: string }; export default function SignUp({ nextPath = "/portal" }: Props) { const router = useRouter(); const [username, setUsername] = useState(""); - const [email, setEmail] = useState(""); // optional if your backend allows + const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [loading, setLoading] = useState(false); @@ -38,8 +38,15 @@ export default function SignUp({ nextPath = "/portal" }: Props) { const res = await fetch("/api/auth/register", { method: "POST", credentials: "include", - headers: { "Content-Type": "application/json", Accept: "application/json" }, - body: JSON.stringify({ username: u, email: em || undefined, password: pw }), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + }, + body: JSON.stringify({ + username: u, + email: em || undefined, + password: pw, + }), }); const txt = await res.text(); @@ -58,7 +65,7 @@ export default function SignUp({ nextPath = "/portal" }: Props) { throw new Error(message); } - // If the server has AUTO_LOGIN on, user is already signed in here. + // If AUTO_LOGIN is enabled on the server, the user is already signed in. router.replace(nextPath); router.refresh(); } catch (e: any) { @@ -68,12 +75,14 @@ export default function SignUp({ nextPath = "/portal" }: Props) { } }, [username, email, password, nextPath, router] - ); + ); // <-- make sure this closing ); is present return (

Create Account

-

Join MakerDash to manage rigs, settings, and projects.

+

+ Join MakerDash to manage rigs, settings, and projects. +

@@ -108,4 +117,45 @@ export default function SignUp({ nextPath = "/portal" }: Props) { +
+ setPassword(e.currentTarget.value)} + required + minLength={8} + /> +
+ + {err && ( +
+ {err} +
+ )} + + + + +
+ Already have an account?{" "} + + Sign in + +
+ + ); +}