Files
qBittorrent/src/webui/www/private/login.html
Gabriele 0a512e41c9 WebUI: Select username on login page load
On logout, the input field is not empty. Select its content.
2014-12-10 21:56:27 +01:00

88 lines
2.8 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>_(qBittorrent web User Interface)</title>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript" src="scripts/mootools-1.2-core-yc.js" charset="utf-8"></script>
<script type="text/javascript">
window.onload = function() {
$('username').focus();
$('username').select();
}
window.addEvent('domready', function() {
$('loginform').addEvent('submit', function(e) {
new Event(e).stop();
submitLoginForm();
});
});
function submitLoginForm() {
new Request({
url: '/login',
method: 'post',
data: $('loginform').toQueryString(),
onComplete: function() {
$('password').set('value', '');
},
onFailure: function(xhr) {
if (xhr.responseText != "") {
$('error_msg').set('html', xhr.responseText);
} else {
$('error_msg').set('html', '_(Unable to log in, qBittorrent is probably unreachable.)');
}
},
onSuccess: function(text) {
if (text == "Ok.") {
// Session started. Simply reload page.
window.location.reload();
} else {
$('error_msg').set('html', '_(Invalid Username or Password.)');
}
}
}).send();
}
</script>
<style type="text/css">
.col {
display: inline-block;
vertical-align: middle;
}
.row {
margin-bottom: 5px;
}
#main {
margin-left: auto;
margin-right: auto;
text-align: center;
padding-top: 5em;
}
#formplace {
text-align: left;
padding: 10px;
}
#error_msg {
color: #f00;
}
</style>
</head>
<body>
<div id="main">
<h1>_(qBittorrent web User Interface)</h1>
<div id="logo" class="col">
<img src="images/qbittorrent.png" alt="qBittorrent logo"/>
</div>
<div id="formplace" class="col">
<form id="loginform" action="">
<div class="row"><label for="username">_(Name)</label><br /><input type="text" id="username" name="username" /></div>
<div class="row"><label for="password">_(Password)</label><br /><input type="password" id="password" name="password" /></div>
<div class="row"><input type="submit" id="login" value="_(Login)" /></div>
</form>
</div>
<div id="error_msg"></div>
</div>
</body>
</html>