WebUI: Minor optimizations to the login page

This commit is contained in:
sledgehammer999 2023-03-20 17:27:32 +02:00 committed by Vladimir Golovnev (glassez)
parent 3007762864
commit 43300d97e2
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
2 changed files with 5 additions and 8 deletions

View file

@ -23,14 +23,14 @@
<img src="images/qbittorrent-tray.svg" alt="qBittorrent logo" />
</div>
<div id="formplace" class="col">
<form id="loginform" method="post" onsubmit="submitLoginForm();">
<form id="loginform" method="post" onsubmit="submitLoginForm(event);">
<div class="row">
<label for="username">QBT_TR(Username)QBT_TR[CONTEXT=HttpServer]</label><br />
<input type="text" id="username" name="username" autocomplete="username" />
<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 />
<input type="password" id="password" name="password" autocomplete="current-password" />
<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]" />

View file

@ -31,13 +31,10 @@
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('username').focus();
document.getElementById('username').select();
document.getElementById('loginform').addEventListener('submit', function(e) {
e.preventDefault();
});
});
function submitLoginForm() {
function submitLoginForm(event) {
event.preventDefault();
const errorMsgElement = document.getElementById('error_msg');
const xhr = new XMLHttpRequest();