This commit is contained in:
dekun
2026-05-30 16:01:35 +08:00
parent 979054546c
commit cdbe087202
6 changed files with 235 additions and 20 deletions
+13 -4
View File
@@ -78,7 +78,10 @@
var password = fd.get("password");
fetch("/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
headers: {
"Content-Type": "application/json",
"X-Nav-Embed": window.self !== window.top ? "1" : "0",
},
credentials: "same-origin",
body: JSON.stringify({ username: username, password: password }),
})
@@ -88,9 +91,15 @@
});
})
.then(function (x) {
if (x.ok && x.body && x.body.redirect) {
window.location.href = x.body.redirect;
return;
if (x.ok && x.body) {
var dest =
window.self !== window.top && x.body.embed_auth_url
? x.body.embed_auth_url
: x.body.redirect || "/dashboard";
if (dest) {
window.location.href = dest;
return;
}
}
errEl.textContent = (x.body && x.body.detail) || "登录失败";
})