Fix terms acceptance enforcement in register

- Add termsAccepted to raw form data object
- Check if terms were accepted before DB insert
- Return error if terms not accepted
- All TypeScript and Biome checks pass
This commit is contained in:
openhands committed 2026-08-14 17:10:40 +02:00
1 parent 0f35bc8529
commit 3d89e108f3
1 file changed
+5
+5
View File
@@ -52,6 +52,7 @@ export async function register(
String(formData.get("look") ?? "")
.normalize("NFC")
.trim() || DEFAULT_LOOK,
termsAccepted: formData.get("terms") === "on",
};
const parsed = registerSchema.safeParse(raw);
@@ -76,6 +77,10 @@ export async function register(
return "Captcha verification failed. Please try again.";
}
// Terms acceptance check.
if (!raw.termsAccepted)
return "You must accept the terms and conditions to register.";
// VPN/proxy block (only when enabled in /admin/vpn).
if ((await checkVpn(ip)).blocked) {
return (