WebUI: Fix reloading page after login

PR  #21832.
---------

Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
This commit is contained in:
Evgenii Ryshkov 2024-11-18 21:20:04 +03:00 committed by GitHub
parent c9c85eeb95
commit 1e851b3637
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -51,10 +51,13 @@ const submitLoginForm = (event) => {
}) })
.then(async (response) => { .then(async (response) => {
const responseText = await response.text(); const responseText = await response.text();
if (response.ok && (responseText === "Ok.")) if (response.ok && (responseText === "Ok.")) {
location.replace(location); // redirect location.replace(location); // redirect
else location.reload(true);
}
else {
errorMsgElement.textContent = `QBT_TR(Invalid Username or Password.)QBT_TR[CONTEXT=Login]\nQBT_TR(Server response:)QBT_TR[CONTEXT=Login] ${responseText}`; errorMsgElement.textContent = `QBT_TR(Invalid Username or Password.)QBT_TR[CONTEXT=Login]\nQBT_TR(Server response:)QBT_TR[CONTEXT=Login] ${responseText}`;
}
}, },
(error) => { (error) => {
errorMsgElement.textContent = `QBT_TR(Unable to log in, server is probably unreachable.)QBT_TR[CONTEXT=Login]\n${error}`; errorMsgElement.textContent = `QBT_TR(Unable to log in, server is probably unreachable.)QBT_TR[CONTEXT=Login]\n${error}`;