← back to Dw Signup Fulfillment
5x sweep 1: client-side email validation on /claim (empty submit no longer fires a 400)
535e4f88e87aa23763b3e612a13d57f7bcaacf3e · 2026-08-14 16:31:57 -0700 · steve
Files touched
Diff
commit 535e4f88e87aa23763b3e612a13d57f7bcaacf3e
Author: steve <steve@designerwallcoverings.com>
Date: Fri Aug 14 16:31:57 2026 -0700
5x sweep 1: client-side email validation on /claim (empty submit no longer fires a 400)
---
server.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/server.js b/server.js
index 051185d..c7118a5 100644
--- a/server.js
+++ b/server.js
@@ -234,6 +234,9 @@ function claimPage() {
async function go(){
const email=document.getElementById('e').value.trim();
const m=document.getElementById('m');
+ // Validate client-side (same rule as the server) BEFORE any network call, so an
+ // empty/invalid email shows instant inline feedback instead of firing a 400.
+ if(!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(email)){ m.style.color='#b91c1c'; m.textContent='Please enter a valid email address.'; return; }
m.style.color='#6b7280'; m.textContent='Sending…';
try{ const r=await fetch('/claim',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({email})});
const j=await r.json(); m.style.color=j.ok?'#16a34a':'#b91c1c'; m.textContent=j.ok?j.message:(j.error||'Something went wrong'); }
← aa70472 auto-data-snapshot: 2026-08-14T14:26:13 (1 data files) — pac
·
back to Dw Signup Fulfillment
·
5x sweep: /verify returns 200 for invalid/expired human link e642d0d →