Initial commit
This commit is contained in:
16
app/api/auth/captcha/route.ts
Normal file
16
app/api/auth/captcha/route.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { NextRequest } from "next/server";
|
||||
import { generateCaptcha } from "../../../../lib/captcha";
|
||||
import { ok } from "../../../../lib/http";
|
||||
|
||||
export async function GET(req: NextRequest) {
|
||||
const { id, code } = generateCaptcha(Date.now().toString());
|
||||
|
||||
// Log the code to console for dev/demo purposes
|
||||
console.log(`CAPTCHA Code: ${code}`);
|
||||
|
||||
return ok({
|
||||
captchaId: id,
|
||||
captchaCode: code, // Return the code to display to user
|
||||
message: "CAPTCHA code generated. Enter it below to continue.",
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user