修复
This commit is contained in:
@@ -24,14 +24,57 @@
|
||||
<div class="matrix-login-badge">SECURE CHANNEL</div>
|
||||
<div class="matrix-login-glitch" data-text="> AUTHENTICATE">> AUTHENTICATE</div>
|
||||
<p class="matrix-login-sub">MATRIX // GATE USDT PERP FUNNEL · 未授权区域禁止访问</p>
|
||||
<form method="post" action="/login" class="matrix-login-form">
|
||||
<form id="matrixLoginForm" method="post" action="/login" class="matrix-login-form">
|
||||
<label class="matrix-label">操作员 ID</label>
|
||||
<input class="matrix-input" type="text" name="username" required autocomplete="username" />
|
||||
<label class="matrix-label">密钥</label>
|
||||
<input class="matrix-input" type="password" name="password" required autocomplete="current-password" />
|
||||
<button type="submit" class="matrix-btn matrix-btn-full matrix-btn-pulse">建立会话</button>
|
||||
</form>
|
||||
<div class="matrix-error">{{ error }}</div>
|
||||
<div class="matrix-error" id="matrixLoginError">{{ error }}</div>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var form = document.getElementById("matrixLoginForm");
|
||||
var errEl = document.getElementById("matrixLoginError");
|
||||
if (!form) return;
|
||||
form.addEventListener("submit", function (e) {
|
||||
e.preventDefault();
|
||||
if (errEl) errEl.textContent = "";
|
||||
var fd = new FormData(form);
|
||||
var btn = form.querySelector('button[type="submit"]');
|
||||
if (btn) btn.disabled = true;
|
||||
fetch("/api/auth/login", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json", Accept: "application/json" },
|
||||
credentials: "same-origin",
|
||||
body: JSON.stringify({
|
||||
username: fd.get("username"),
|
||||
password: fd.get("password"),
|
||||
}),
|
||||
})
|
||||
.then(function (r) {
|
||||
return r.json().then(function (j) {
|
||||
return { ok: r.ok, body: j };
|
||||
});
|
||||
})
|
||||
.then(function (x) {
|
||||
if (x.ok && x.body && x.body.redirect) {
|
||||
window.location.href = x.body.redirect;
|
||||
return;
|
||||
}
|
||||
if (errEl) {
|
||||
errEl.textContent = (x.body && x.body.detail) || "登录失败";
|
||||
}
|
||||
})
|
||||
.catch(function () {
|
||||
if (errEl) errEl.textContent = "网络错误或会话 Cookie 被拦截(iframe 嵌入须 HTTPS + NAV_EMBED_ORIGINS)";
|
||||
})
|
||||
.finally(function () {
|
||||
if (btn) btn.disabled = false;
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user