Import source: vault/app/api/auth/captcha/route
Import the existing local project snapshot. This commit organizes existing files; it does not represent newly developed functionality.
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
import { NextResponse } from "next/server";
|
||||||
|
import { createCaptchaChallenge } from "@/lib/server-security";
|
||||||
|
import { jsonError } from "@/lib/server-api";
|
||||||
|
import { isRateLimited } from "@/lib/server-rate-limit";
|
||||||
|
|
||||||
|
export async function GET(request: Request) {
|
||||||
|
if (await isRateLimited(request, "captcha", 60, 60_000)) {
|
||||||
|
return jsonError("Too many captcha requests. Try again shortly.", 429);
|
||||||
|
}
|
||||||
|
|
||||||
|
const challenge = await createCaptchaChallenge();
|
||||||
|
return NextResponse.json({ challenge });
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user