1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 07:18:08 +00:00

Merge pull request #2117 from glassez/webui

WebUI Fixes
This commit is contained in:
sledgehammer999 2014-11-03 17:00:34 +02:00
commit a63d4e3400
4 changed files with 24 additions and 13 deletions

BIN
src/Icons/qbittorrent.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file>Icons/qbittorrent.png</file>
<file>Icons/3-state-checkbox.gif</file> <file>Icons/3-state-checkbox.gif</file>
<file>Icons/L.gif</file> <file>Icons/L.gif</file>
<file>Icons/loading.png</file> <file>Icons/loading.png</file>

View File

@ -38,22 +38,25 @@
AbstractRequestHandler::AbstractRequestHandler(const HttpRequest &request, const HttpEnvironment &env, WebApplication *app) AbstractRequestHandler::AbstractRequestHandler(const HttpRequest &request, const HttpEnvironment &env, WebApplication *app)
: app_(app), session_(0), request_(request), env_(env) : app_(app), session_(0), request_(request), env_(env)
{ {
if (isBanned())
{
status(403, "Forbidden");
print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."));
return;
}
sessionInitialize(); sessionInitialize();
if (!sessionActive() && !isAuthNeeded())
if (!sessionActive() && !isAuthNeeded()) sessionStart(); sessionStart();
} }
HttpResponse AbstractRequestHandler::run() HttpResponse AbstractRequestHandler::run()
{ {
response_ = HttpResponse(); response_ = HttpResponse();
processRequest();
if (isBanned())
{
status(403, "Forbidden");
print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."));
}
else
{
processRequest();
}
return response_; return response_;
} }

View File

@ -20,8 +20,15 @@
url: '/login', url: '/login',
method: 'post', method: 'post',
data: $('loginform').toQueryString(), data: $('loginform').toQueryString(),
onFailure: function() { onComplete: function() {
alert("_(Unable to log in, qBittorrent is probably unreachable.)"); $('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) { onSuccess: function(text) {
if (text == "Ok.") { if (text == "Ok.") {
@ -61,7 +68,7 @@
<div id="main"> <div id="main">
<h1>_(qBittorrent web User Interface)</h1> <h1>_(qBittorrent web User Interface)</h1>
<div id="logo" class="col"> <div id="logo" class="col">
<img src="images/skin/mascot.png" /> <img src="images/qbittorrent.png" />
</div> </div>
<div id="formplace" class="col"> <div id="formplace" class="col">
<form id="loginform" action=""> <form id="loginform" action="">