Cross-wire rescue: either username works in either param
?ref=<ctb-username> now forward-resolves to the member's real ClickBaitPays ref (Marty hit this live with ref=r03430451480 -> now resolves opgnetwerk); ?ctb=<cbp-username> reverse-resolves symmetrically. Wrong-slot links from confused members self-heal instead of leaking CTB usernames into CBP refs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
+21
-1
@@ -2377,22 +2377,42 @@ async function resolveIdentity() {
|
||||
const p = new URLSearchParams(window.location.search);
|
||||
const ctbParam = (p.get('ctb') || '').trim();
|
||||
try {
|
||||
// Members mix the two usernames up constantly, so each param tries its
|
||||
// own direction FIRST, then rescues by trying the other (a CTB username
|
||||
// pasted into ?ref=, or a CBP username pasted into ?ctb=, both resolve).
|
||||
if (ctbParam) {
|
||||
const r = await fetch(`${CTB_LOOKUP_URL}?ctb=${encodeURIComponent(ctbParam)}`).then(x => x.json());
|
||||
if (r.found) {
|
||||
IDENT.cbp = r.cbpUsername;
|
||||
IDENT.ctb = r.ctbUsername;
|
||||
} else {
|
||||
const rv = await fetch(`${CTB_LOOKUP_URL}?cbp=${encodeURIComponent(ctbParam)}`).then(x => x.json());
|
||||
if (rv.found) {
|
||||
IDENT.cbp = rv.cbpUsername;
|
||||
IDENT.ctb = rv.ctbUsername;
|
||||
} else {
|
||||
// No ClickBaitPays entry in their downline builder: CBP signups fall
|
||||
// back to the team account, but the hub link still aligns them in CTB.
|
||||
IDENT.ctb = ctbParam;
|
||||
IDENT.fallback = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Legacy/current ?ref= links (or the default): reverse-resolve the CTB
|
||||
// username so the Team Hub invite personalizes to the same sponsor.
|
||||
const r = await fetch(`${CTB_LOOKUP_URL}?cbp=${encodeURIComponent(IDENT.cbp)}`).then(x => x.json());
|
||||
if (r.found) IDENT.ctb = r.ctbUsername;
|
||||
if (r.found) {
|
||||
IDENT.ctb = r.ctbUsername;
|
||||
} else {
|
||||
// Rescue: the ?ref= value may actually BE a CTB username (Marty hit
|
||||
// this live 2026-08-01 with ?ref=<ctb-username>). Forward-resolve it
|
||||
// and adopt the member's real ClickBaitPays ref for the signup links.
|
||||
const f = await fetch(`${CTB_LOOKUP_URL}?ctb=${encodeURIComponent(IDENT.cbp)}`).then(x => x.json());
|
||||
if (f.found) {
|
||||
IDENT.cbp = f.cbpUsername;
|
||||
IDENT.ctb = f.ctbUsername;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Lookup unreachable: defaults stand, nothing breaks.
|
||||
|
||||
Reference in New Issue
Block a user