From f1c6020e5c8a9b06aa09fc2e1759ec26b35692f2 Mon Sep 17 00:00:00 2001 From: twotalesanimation <80506065+twotalesanimation@users.noreply.github.com> Date: Tue, 18 Aug 2026 16:33:54 +0200 Subject: [PATCH] Remove bootstrap signup page Admin account has been created; the one-time setup page is no longer needed. Co-Authored-By: Claude Sonnet 5 --- src/actions/setup.ts | 45 --------------------- src/app/signup/page.tsx | 45 --------------------- src/components/auth/signup-form.tsx | 62 ----------------------------- src/proxy.ts | 2 +- 4 files changed, 1 insertion(+), 153 deletions(-) delete mode 100644 src/actions/setup.ts delete mode 100644 src/app/signup/page.tsx delete mode 100644 src/components/auth/signup-form.tsx diff --git a/src/actions/setup.ts b/src/actions/setup.ts deleted file mode 100644 index 8026d48..0000000 --- a/src/actions/setup.ts +++ /dev/null @@ -1,45 +0,0 @@ -"use server"; - -import bcrypt from "bcryptjs"; -import { prisma } from "@/lib/prisma"; - -export interface CreateFirstUserState { - error?: string; - success?: boolean; -} - -// Bootstrap-only: only works while the users table is empty, so this can't -// be used to create accounts once the real admin user exists. -export async function createFirstUser( - _prevState: CreateFirstUserState, - formData: FormData -): Promise { - const email = String(formData.get("email") || "").toLowerCase().trim(); - const password = String(formData.get("password") || ""); - const name = String(formData.get("name") || "").trim(); - - if (!email || !password) { - return { error: "Email and password are required." }; - } - if (password.length < 8) { - return { error: "Password must be at least 8 characters long." }; - } - - const existingCount = await prisma.user.count(); - if (existingCount > 0) { - return { error: "An account already exists. This setup page is disabled." }; - } - - const hashedPassword = await bcrypt.hash(password, 12); - - await prisma.user.create({ - data: { - email, - password: hashedPassword, - name: name || null, - role: "ADMIN", - }, - }); - - return { success: true }; -} diff --git a/src/app/signup/page.tsx b/src/app/signup/page.tsx deleted file mode 100644 index c158973..0000000 --- a/src/app/signup/page.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { prisma } from "@/lib/prisma"; -import { SignupForm } from "@/components/auth/signup-form"; -import { Film } from "lucide-react"; - -export const dynamic = "force-dynamic"; - -export const metadata = { - title: "Set up account — xBid", -}; - -export default async function SignupPage() { - const userCount = await prisma.user.count(); - - return ( -
-
-
-
- -
-
-

- xBid -

-

- {userCount > 0 ? "Setup already complete" : "Create your account"} -

-
-
- - {userCount > 0 ? ( -

- An account already exists, so this setup page is disabled.{" "} - - Go to sign in - - . -

- ) : ( - - )} -
-
- ); -} diff --git a/src/components/auth/signup-form.tsx b/src/components/auth/signup-form.tsx deleted file mode 100644 index 49e7ed5..0000000 --- a/src/components/auth/signup-form.tsx +++ /dev/null @@ -1,62 +0,0 @@ -"use client"; - -import { useActionState } from "react"; -import { Button } from "@/components/ui/button"; -import { Input } from "@/components/ui/input"; -import { Label } from "@/components/ui/label"; -import { Card, CardContent } from "@/components/ui/card"; -import { createFirstUser, type CreateFirstUserState } from "@/actions/setup"; - -const initialState: CreateFirstUserState = {}; - -export function SignupForm() { - const [state, action, pending] = useActionState(createFirstUser, initialState); - - if (state.success) { - return ( - - -

- Account created. You can delete the signup page now — sign in at{" "} - - /login - - . -

-
-
- ); - } - - return ( - - -
-
- - -
-
- - -
-
- - -
- {state.error &&

{state.error}

} - -
-
-
- ); -} diff --git a/src/proxy.ts b/src/proxy.ts index 37e68e5..8f1b757 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -2,7 +2,7 @@ import { NextResponse } from "next/server"; import type { NextRequest } from "next/server"; import { getToken } from "next-auth/jwt"; -const PUBLIC_PATHS = ["/login", "/signup"]; +const PUBLIC_PATHS = ["/login"]; export default async function proxy(request: NextRequest) { const { pathname } = request.nextUrl;