diff options
Diffstat (limited to 'src/routes/(static)')
| -rw-r--r-- | src/routes/(static)/register/+page.server.ts | 7 |
1 files changed, 6 insertions, 1 deletions
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 }; }; |
