diff --git a/server.js b/server.js index 8614f16..4f14995 100644 --- a/server.js +++ b/server.js @@ -185,6 +185,7 @@ function chatLimited(ip) { } // magic-code sign-in: emailLower -> {code, exp, tries} const emailCodes = new Map(); +const inviteTokens = new Map(); // admin-minted one-time sign-in links for testers: token -> {email, exp, next} // ── sign-up code guard (Marty, 2026-09-11): the email box is one field and one // tap, so nothing visible stands in a human's way. Bots hit four invisible walls: // a honeypot field, a minimum form age, per-IP + global send limits, and, only @@ -894,6 +895,14 @@ const server = http.createServer(async (req, res) => { } if (p === '/api/zone/seen' && (req.method === 'GET' || req.method === 'POST')) { await zones.seen(u.searchParams.get('i'), req); res.writeHead(204, { 'Access-Control-Allow-Origin': '*' }); return res.end(); } { const zm = /^\/api\/zone\/click\/([a-f0-9]{12})$/.exec(p); if (zm && req.method === 'GET') { const target = await zones.click(zm[1]); res.writeHead(302, { Location: target || '/', 'Cache-Control': 'no-store', 'Referrer-Policy': 'no-referrer-when-downgrade' }); return res.end(); } } + { const wm = /^\/welcome\/([a-f0-9]{48})$/.exec(p); if (wm && req.method === 'GET') { // one-time tester sign-in link + const t = inviteTokens.get(wm[1]); + if (!t || t.exp < Date.now()) { inviteTokens.delete(wm[1]); res.writeHead(410, { 'Content-Type': 'text/html; charset=utf-8' }); return res.end('
That sign-in link was already used or has expired. Ask for a fresh one.
'); } + inviteTokens.delete(wm[1]); + const acct = await accounts.byEmail(t.email); let memberId = 0; if (acct && acct.address) { try { memberId = await chain.memberIdByAccount(acct.address); } catch (e) {} } + const token = await auth.mintSession({ email: t.email, address: (acct && acct.address) || null, memberId }); + res.writeHead(302, { 'Set-Cookie': auth.sessionCookie(token), Location: t.next || '/ads', 'Cache-Control': 'no-store' }); return res.end(); + } } // -- member pages: /p/