From 8f44a8e8f1dc1b17bdf3edf534c32c04aaa5e2d6 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 1 Oct 2025 08:59:30 -0700 Subject: register challenge --- src/routes/(static)/register/+page.server.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/routes/(static)/register/+page.server.ts b/src/routes/(static)/register/+page.server.ts index 284c5a61..47ff8d27 100644 --- a/src/routes/(static)/register/+page.server.ts +++ b/src/routes/(static)/register/+page.server.ts @@ -1,5 +1,4 @@ -import { randomUUID } from "crypto"; -import { fd, get, captchas, register } from "$lib/utils"; +import { fd, get, register } from "$lib/utils"; import { redirect } from "@sveltejs/kit"; export const load = async ({ parent }) => { @@ -9,10 +8,6 @@ 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 }; }; @@ -20,11 +15,11 @@ export const actions = { default: async ({ cookies, request }) => { const ip = request.headers.get("cf-connecting-ip"); const form = await fd(request); - const { picture, username, password } = form; + const { picture, username, password, challenge } = form; let { loginRedirect } = form; if (loginRedirect === "undefined") loginRedirect = undefined; - const user = { picture, username, password }; + const user = { picture, username, password, challenge }; return register(user, ip, cookies, loginRedirect); }, }; -- cgit v1.2.3