account settings and account creation

This commit is contained in:
2025-12-27 20:01:17 -05:00
parent aa2dfb0407
commit 2202abe89f
21 changed files with 1848 additions and 718 deletions
+26 -5
View File
@@ -1,22 +1,43 @@
// app/api/beta-signup/route.ts
import { NextResponse } from "next/server";
const API_BASE_URL =
process.env.NEXT_PUBLIC_API_BASE_URL ?? "http://localhost:8080";
const TOS_VERSION = "2025-12-27";
type BetaSignupBody = {
email?: string;
useCase?: string;
acceptedTos?: boolean;
tosVersion?: string;
};
export async function POST(req: Request) {
try {
const body = await req.json();
const body = (await req.json()) as BetaSignupBody;
const email = (body.email ?? "").trim().toLowerCase();
const useCase = (body.useCase ?? "").trim();
const acceptedTos = Boolean(body.acceptedTos);
const tosVersion = (body.tosVersion ?? TOS_VERSION).trim() || TOS_VERSION;
// Keep "no enumeration": always return ok:true, but silently refuse bad input
if (!email || !acceptedTos) {
return NextResponse.json({ ok: true });
}
// Forward only known fields
const payload = { email, useCase, acceptedTos, tosVersion };
const res = await fetch(`${API_BASE_URL}/api/auth/beta/signup`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
body: JSON.stringify(payload),
cache: "no-store",
});
// Always return ok=true (matches your server behavior)
if (!res.ok) {
// Optional: log server response for debugging
const text = await res.text().catch(() => "");
console.error("beta-signup proxy failed:", res.status, text);
}
@@ -24,6 +45,6 @@ export async function POST(req: Request) {
return NextResponse.json({ ok: true });
} catch (e) {
console.error("beta-signup proxy error:", e);
return NextResponse.json({ ok: true }); // keep “no enumeration”
return NextResponse.json({ ok: true });
}
}