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:
1 parent
0f35bc8529
commit
3d89e108f3
1 file changed
+5
@@ -52,6 +52,7 @@ export async function register(
|
|||||||
String(formData.get("look") ?? "")
|
String(formData.get("look") ?? "")
|
||||||
.normalize("NFC")
|
.normalize("NFC")
|
||||||
.trim() || DEFAULT_LOOK,
|
.trim() || DEFAULT_LOOK,
|
||||||
|
termsAccepted: formData.get("terms") === "on",
|
||||||
};
|
};
|
||||||
|
|
||||||
const parsed = registerSchema.safeParse(raw);
|
const parsed = registerSchema.safeParse(raw);
|
||||||
@@ -76,6 +77,10 @@ export async function register(
|
|||||||
return "Captcha verification failed. Please try again.";
|
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).
|
// VPN/proxy block (only when enabled in /admin/vpn).
|
||||||
if ((await checkVpn(ip)).blocked) {
|
if ((await checkVpn(ip)).blocked) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in new issue
Block a user