diff --git a/server.js b/server.js index 4fd073e..094b5bf 100644 --- a/server.js +++ b/server.js @@ -50,6 +50,7 @@ async function notify(kind, p) { if (kind === 'paid') return telegram('\u{1F3AE} Drip Runner · paid ' + who + ' ' + fmt(p.pol) + ' POL · verify'); if (kind === 'failed') return telegram('❌ Drip Runner · payout to ' + who + ' failed: ' + p.error); if (kind === 'low') return telegram('⚠️ Drip Runner wallet is low: ' + fmt(p.balance) + ' POL in ' + p.address + ' (needs ' + fmt(p.threshold) + ').'); + if (kind === 'refused') return telegram('\u{1F6AB} Drip Runner \u00b7 ' + who + ' (' + p.email + ') tried to sign in but is not on the tester list. Add them under Admin > Settings > Testers: ' + SITE + '/admin'); if (kind === 'signin') return telegram('\u{1F44B} Drip Runner · first sign-in: ' + who + ' (' + (p.wallet ? 'wallet on file' : 'NO wallet yet') + ')'); if (kind === 'refuel') return telegram('⛽ Drip Runner · ' + who + ' refuelled on campaign #' + p.campaignId + ': +' + fmt(p.pol) + ' POL to the pool (' + p.credits + ' credits, $' + p.share + ' share)'); return false; @@ -118,6 +119,7 @@ const server = http.createServer(async (req, res) => { if (p === '/auth') { const r = sso.verify(u.searchParams.get('t')); if (r.error) return page(res, 400, 'Sign-in did not work', '

' + esc(r.error) + '

Try again from InstantAdPay

'); + if (!allowed(r.claims)) { console.log('hand-off refused: not a tester', r.claims.memberId, r.claims.username || '', String(r.claims.email || '').replace(/^(.).*(@.*)$/, '$1***$2')); notify('refused', { memberId: r.claims.memberId, username: r.claims.username, email: r.claims.email }).catch(() => {}); } if (!allowed(r.claims)) return page(res, 403, 'Not on the tester list yet', '

Drip Runner is in a closed trial. Your InstantAdPay account (' + esc(r.claims.username ? '@' + r.claims.username : '#' + r.claims.memberId) + ') is not on the tester list. Ask Marty to add you.

'); const existing = sso.fromRequest(req); let sid;