Traffic exchanges: inside another site's frame, sign-in/join and off-site links open in a new tab (sign-in cookies are refused in frames)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-03 19:23:04 -05:00
parent b53de647b9
commit 563ece9896
21 changed files with 36 additions and 21 deletions
+5 -1
View File
@@ -72,7 +72,11 @@
IAP.status(r.sent ? 'Code sent. Check your inbox (and spam, the first time).' : 'Dev mode: code filled in.', 'ok');
$('jnCode').focus();
});
$('jnSend').addEventListener('click', send);
// framed: the code would arrive but the sign-in cookie would be refused, so the sign-up continues in a full window
// with the email filled in (the link carries the invite token, so the sponsor holds)
let framed = false; try { framed = window.top !== window.self; } catch (e) { framed = true; }
$('jnSend').addEventListener('click', framed ? () => { const t = new URL(location.href); const em = ($('jnEmail').value || '').trim(); if (em) t.searchParams.set('email', em); window.open(t.toString(), '_blank', 'noopener'); IAP.status('Opened InstantAdPay in a new tab. Finish joining there.', 'ok'); } : send);
try { const em = new URLSearchParams(location.search).get('email'); if (em && $('jnEmail') && !$('jnEmail').value) $('jnEmail').value = em.slice(0, 120); } catch (e) {}
$('jnResend').addEventListener('click', busy($('jnResend'), async () => {
const r = await IAP.requestCode($('jnEmail').value, codeOpts());
if (r.devCode) $('jnCode').value = r.devCode;