diff --git a/lib/sso.js b/lib/sso.js index d65106c..e130e80 100644 --- a/lib/sso.js +++ b/lib/sso.js @@ -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); diff --git a/public/index.html b/public/index.html index 0466bd1..65ce69b 100644 --- a/public/index.html +++ b/public/index.html @@ -19,7 +19,7 @@
If you see "not on the tester list", your IAP account has not been added yet. Tell Marty which username you use.