125续15l-6:token直进路签章显式传player+跳转不被签章阻塞

This commit is contained in:
ypsdf1
2026-11-20 00:52:25 +08:00
parent b8ab513377
commit e65826445f
+11 -6
View File
@@ -488,10 +488,12 @@ require_once __DIR__ . '/captcha_guard.php';
}
// 勾选时同步写签章(PHP rules_ack + 回执文件)
// ★ 125 续15l-6:加可选 player 形参。token 直进路没有 #playerName 输入框,
// 原先从输入框取值恒为空 → 签章没写;现在 token 路显式传 player,密码/邮箱路走输入框。
let AG_MARKED = false;
async function fireAgreementMark() {
async function fireAgreementMark(playerArg) {
if (AG_MARKED) return;
const player = document.getElementById('playerName')?.value?.trim() || '';
const player = playerArg || document.getElementById('playerName')?.value?.trim() || '';
if (!player) return;
AG_MARKED = true;
try {
@@ -538,6 +540,8 @@ require_once __DIR__ . '/captcha_guard.php';
doTokenLogin();
// ===== 未签玩家:勾选门放行后点「进入 Web 端」完成跳转 =====
// ★ 125 续15l-6:签章显式传 player(token 路无 #playerName 输入框),
// 且跳转不再被 fireAgreementMark 的 fetch 阻塞——先跳转,签章后台补写(幂等)。
function enterWeb(player) {
// 二次校验协议门(防止用户没真正勾选就点按钮)
if (AG.need && !AG.already) {
@@ -546,7 +550,6 @@ require_once __DIR__ . '/captcha_guard.php';
return;
}
}
fireAgreementMark();
statusBox.className = 'status-box success';
statusBox.innerHTML = '✅ 已签署用户协议!<br><br>欢迎, <span class="player-name">' + player + '</span><br><small style="color:var(--dim)">正在跳转到玩家商城...</small>';
fetch('./api/sync.php?action=web_access_check', {
@@ -554,9 +557,11 @@ require_once __DIR__ . '/captcha_guard.php';
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({web_token: TOKEN, access_action: 'view'})
}).catch(() => {});
// ★ 跳转立即执行(300ms 让 UI 先刷新),签章后台补写,绝不阻塞跳转
setTimeout(() => {
window.location.href = 'player.php?login=' + encodeURIComponent(player) + '&token=' + encodeURIComponent(TOKEN);
}, 500);
}, 300);
fireAgreementMark(player); // 后台补写签章(token 路显式传 player)
}
// ===== Token验证 =====
@@ -602,8 +607,8 @@ require_once __DIR__ . '/captcha_guard.php';
actionsDiv.innerHTML = '<button class="btn btn-primary" style="width:100%" onclick="enterWeb(' + JSON.stringify(player) + ')">进入 Web 端</button>';
return;
}
// ★ 已签 / 无协议 → 无感登录:直接跳转(fireAgreementMark 幂等,未签才补写)
fireAgreementMark();
// ★ 已签 / 无协议 → 无感登录:直接跳转(fireAgreementMark 幂等,未签才补写;显式传 player)
fireAgreementMark(player);
// ★ Token验证成功 → 直接跳转到player.php(跳过密码,token本身即身份证明)
statusBox.className = 'status-box success';