From b9d37e107a1bc7f9ea70755945eb76d34d3a6457 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sun, 28 Sep 2025 14:15:16 -0700 Subject: register captcha --- src/routes/(static)/register/+page.server.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/routes/(static)') diff --git a/src/routes/(static)/register/+page.server.ts b/src/routes/(static)/register/+page.server.ts index cddd97ea..284c5a61 100644 --- a/src/routes/(static)/register/+page.server.ts +++ b/src/routes/(static)/register/+page.server.ts @@ -1,4 +1,5 @@ -import { fd, get, register } from "$lib/utils"; +import { randomUUID } from "crypto"; +import { fd, get, captchas, register } from "$lib/utils"; import { redirect } from "@sveltejs/kit"; export const load = async ({ parent }) => { @@ -8,6 +9,10 @@ export const load = async ({ parent }) => { const index = Math.floor(Math.random() * 64) + 1; const { challenge } = await get("/challenge"); + const captcha = randomUUID(); + captchas.add(captcha); + setTimeout(() => captchas.delete(captcha), 120000); + return { index, challenge }; }; -- cgit v1.2.3