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:
+3
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user