import { NextResponse, type NextRequest } from "next/server"; import { callMobileApi } from "@/app/lib/server/mobileApi"; // POST → /api/admin/auth/forgot-password (public, no token). The browser always gets 200 {ok:true}: // the answer must not reveal whether the account exists, so upstream errors are never forwarded. // Same-origin and body-size checks are enforced for every /api write by middleware. export async function POST(req: NextRequest) { const body = (await req.json().catch(() => ({}))) as { username?: unknown; email?: unknown }; const username = typeof body.username === "string" ? body.username.trim() : ""; const email = typeof body.email === "string" ? body.email.trim() : ""; if (username && email) { await callMobileApi("/api/admin/auth/forgot-password", { method: "POST", body: { username, email } }); } return NextResponse.json({ ok: true }); }