Hand-off: free members without an on-chain id are keyed on their email; tester page wording

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-09-30 13:29:33 -05:00
parent 903b5065b9
commit 90a56bce74
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -37,7 +37,9 @@ function open(token) {
function verify(token) {
const r = open(token); if (r.error) return r;
const c = r.claims;
if (!c.memberId || !c.email) return { error: 'That sign-in link is missing your account.' };
if (!c.email) return { error: 'That sign-in link is missing your account.' };
// a free member with no wallet has no on-chain id yet: key them on their email until they link one
if (!(Number(c.memberId) > 0)) c.memberId = -parseInt(crypto.createHash('sha256').update(String(c.email).toLowerCase()).digest('hex').slice(0, 11), 16);
for (const [n, exp] of used) if (exp < Date.now()) used.delete(n);
if (used.has(c.nonce)) return { error: 'That sign-in link was already used.' };
used.set(c.nonce, c.exp);