修复
This commit is contained in:
@@ -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) || "登录失败";
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user