Avoid leaking user locale preference to the web

This commit is contained in:
Chocobo1 2024-02-19 14:20:08 +08:00
parent 3f2b4afc21
commit 66c34ddb6e
2 changed files with 8 additions and 8 deletions

View file

@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<meta name="color-scheme" content="light dark" />
<meta name="description" content="qBittorrent WebUI">
<title>qBittorrent QBT_TR(WebUI)QBT_TR[CONTEXT=OptionsDialog]</title>
<title>qBittorrent WebUI</title>
<link rel="icon" type="image/png" href="images/qbittorrent32.png" />
<link rel="icon" type="image/svg+xml" href="images/qbittorrent-tray.svg" />
<link rel="stylesheet" type="text/css" href="css/login.css?v=${CACHEID}" />
@ -17,25 +17,25 @@
<body>
<noscript id="noscript">
<h1>QBT_TR(JavaScript Required! You must enable JavaScript for the WebUI to work properly)QBT_TR[CONTEXT=HttpServer]</h1>
<h1>JavaScript Required! You must enable JavaScript for the WebUI to work properly</h1>
</noscript>
<div id="main">
<h1>qBittorrent QBT_TR(WebUI)QBT_TR[CONTEXT=OptionsDialog]</h1>
<h1>qBittorrent WebUI</h1>
<div id="logo" class="col">
<img src="images/qbittorrent-tray.svg" alt="qBittorrent logo" />
</div>
<div id="formplace" class="col">
<form id="loginform" method="post" onsubmit="submitLoginForm(event);">
<div class="row">
<label for="username">QBT_TR(Username)QBT_TR[CONTEXT=HttpServer]</label><br />
<label for="username">Username</label><br />
<input type="text" id="username" name="username" autocomplete="username" required />
</div>
<div class="row">
<label for="password">QBT_TR(Password)QBT_TR[CONTEXT=HttpServer]</label><br />
<label for="password">Password</label><br />
<input type="password" id="password" name="password" autocomplete="current-password" required />
</div>
<div class="row">
<input type="submit" id="login" value="QBT_TR(Login)QBT_TR[CONTEXT=HttpServer]" />
<input type="submit" id="login" value="Login" />
</div>
</form>
</div>

View file

@ -45,13 +45,13 @@ function submitLoginForm(event) {
if ((xhr.status === 200) && (xhr.responseText === "Ok."))
location.reload(true);
else
errorMsgElement.textContent = 'QBT_TR(Invalid Username or Password.)QBT_TR[CONTEXT=HttpServer]';
errorMsgElement.textContent = 'Invalid Username or Password.';
}
});
xhr.addEventListener('error', function() {
errorMsgElement.textContent = (xhr.responseText !== "")
? xhr.responseText
: 'QBT_TR(Unable to log in, qBittorrent is probably unreachable.)QBT_TR[CONTEXT=HttpServer]';
: 'Unable to log in, qBittorrent is probably unreachable.';
});
const usernameElement = document.getElementById('username');