mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
WebUI: Fix reloading page after login
Manual backport of PR #21832
Original author: Evgenii Ryshkov
See commit: 1e851b3637
This commit is contained in:
@@ -37,11 +37,14 @@ function submitLoginForm(event) {
|
|||||||
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||||
xhr.addEventListener("readystatechange", () => {
|
xhr.addEventListener("readystatechange", () => {
|
||||||
if (xhr.readyState === 4) { // DONE state
|
if (xhr.readyState === 4) { // DONE state
|
||||||
if ((xhr.status === 200) && (xhr.responseText === "Ok."))
|
if ((xhr.status === 200) && (xhr.responseText === "Ok.")) {
|
||||||
location.replace(location);
|
location.replace(location);
|
||||||
else
|
location.reload(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
errorMsgElement.textContent = "QBT_TR(Invalid Username or Password.)QBT_TR[CONTEXT=HttpServer]";
|
errorMsgElement.textContent = "QBT_TR(Invalid Username or Password.)QBT_TR[CONTEXT=HttpServer]";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
xhr.addEventListener("error", () => {
|
xhr.addEventListener("error", () => {
|
||||||
errorMsgElement.textContent = (xhr.responseText !== "")
|
errorMsgElement.textContent = (xhr.responseText !== "")
|
||||||
|
|||||||
Reference in New Issue
Block a user