In-game sign-in carries the paid-traffic source: joinedRef = <game host>/<src>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
function mount(el, opt) {
|
||||
styleOnce(); opt = opt || {};
|
||||
var game = opt.game, ref = String(opt.ref || '').toLowerCase().replace(/[^a-z0-9_]/g, '').slice(0, 40);
|
||||
var game = opt.game, ref = String(opt.ref || '').toLowerCase().replace(/[^a-z0-9_]/g, '').slice(0, 40), src = String(opt.src || '').toLowerCase().replace(/[^a-z0-9_.-]/g, '').slice(0, 30);
|
||||
var fts = Date.now(), email = '', newsletter = true, resendAt = 0, timer = null;
|
||||
var onToken = opt.onToken || function (t) { location.href = '/auth?t=' + encodeURIComponent(t); };
|
||||
el.classList.add('iapsi');
|
||||
@@ -60,7 +60,7 @@
|
||||
if (f && f.email) { email = String(f.email.value || '').trim(); newsletter = !!(f.nl && f.nl.checked); }
|
||||
if (!/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(email)) return err('Enter the email you use (or want to use) for InstantAdPay.');
|
||||
err(''); busy(true);
|
||||
post('/api/game/auth/start', { game: game, email: email, ref: ref, fts: fts, hp_field_x9: (f && f.hp_field_x9 && f.hp_field_x9.value) || '', pick: pick || '', dev: devId() }).then(function (r) {
|
||||
post('/api/game/auth/start', { game: game, email: email, ref: ref, src: src, fts: fts, hp_field_x9: (f && f.hp_field_x9 && f.hp_field_x9.value) || '', pick: pick || '', dev: devId() }).then(function (r) {
|
||||
busy(false);
|
||||
if (r.challenge) return stepChallenge(r.challenge, r.error);
|
||||
if (r.ok) { resendAt = Date.now() + 60000; return stepCode(r.devCode); }
|
||||
@@ -94,7 +94,7 @@
|
||||
var f = el.querySelector('form'); var code = String((f && f.code && f.code.value) || '').trim();
|
||||
if (!/^\d{6}$/.test(code)) return err('Enter the 6 digits from the email.');
|
||||
err(''); busy(true);
|
||||
post('/api/game/auth/verify', { game: game, email: email, code: code, ref: ref, newsletter: newsletter, dev: devId() }).then(function (r) {
|
||||
post('/api/game/auth/verify', { game: game, email: email, code: code, ref: ref, src: src, newsletter: newsletter, dev: devId() }).then(function (r) {
|
||||
busy(false);
|
||||
if (r.ok) { clearInterval(timer); return done(r); }
|
||||
if (/expired|too many/i.test(r.error || '')) { clearInterval(timer); return stepEmail(r.error); }
|
||||
|
||||
@@ -1866,7 +1866,8 @@ const server = http.createServer(async (req, res) => {
|
||||
const code = String(Math.floor(100000 + Math.random() * 900000));
|
||||
emailCodes.set(e, { code, exp: Date.now() + 15 * 60 * 1000, tries: 0, nextAt: Date.now() + 60 * 1000 });
|
||||
const ref = pageTok(b.ref);
|
||||
if (!(await accounts.byEmail(e))) pendingSponsor.set(e, { ref: ref || '', via: String(b.game), joinedRef: g.host() });
|
||||
const srcTag = String(b.src || '').toLowerCase().replace(/[^a-z0-9_.-]/g, '').slice(0, 30); // paid-traffic source the game saw (2026-10-03)
|
||||
if (!(await accounts.byEmail(e))) pendingSponsor.set(e, { ref: ref || '', via: String(b.game), joinedRef: g.host() + (srcTag ? '/' + srcTag : '') });
|
||||
console.log('game-signin code', b.game, e.replace(/^(.).*(@.*)$/, '$1***$2'), ref ? 'ref ' + ref : '');
|
||||
if (mailer.hasKey()) {
|
||||
try { await mailer.sendCode(e, code); } catch (err) { console.error('sendCode failed', err.message); return json(res, 502, { error: 'Could not send the email. Try again in a minute.' }, cors); }
|
||||
@@ -1889,7 +1890,8 @@ const server = http.createServer(async (req, res) => {
|
||||
if (fraud.isSuspended(e)) return json(res, 403, { error: 'This account is suspended. Contact support.' }, cors);
|
||||
const pend = pendingSponsor.get(e);
|
||||
const ref = pageTok(b.ref) || (pend && pend.ref) || '';
|
||||
const via = String(b.game); const joinedRef = (pend && pend.joinedRef) || g.host();
|
||||
const via = String(b.game); const srcTag = String(b.src || '').toLowerCase().replace(/[^a-z0-9_.-]/g, '').slice(0, 30);
|
||||
const joinedRef = (pend && pend.joinedRef) || (g.host() + (srcTag ? '/' + srcTag : '')); // e.g. driprunner.app/adsterra
|
||||
let fraudFlags = [];
|
||||
const existing = await accounts.byEmail(e);
|
||||
if (!existing) { // one account per person, exactly as on the dashboard
|
||||
|
||||
Reference in New Issue
Block a user