Browse Source

Merge pull request #2117 from glassez/webui

WebUI Fixes
adaptive-webui-19844
sledgehammer999 10 years ago
parent
commit
a63d4e3400
  1. BIN
      src/Icons/qbittorrent.png
  2. 1
      src/icons.qrc
  3. 23
      src/webui/abstractrequesthandler.cpp
  4. 13
      src/webui/www/private/login.html

BIN
src/Icons/qbittorrent.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

1
src/icons.qrc

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

23
src/webui/abstractrequesthandler.cpp

@ -38,22 +38,25 @@ @@ -38,22 +38,25 @@
AbstractRequestHandler::AbstractRequestHandler(const HttpRequest &request, const HttpEnvironment &env, WebApplication *app)
: 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();
if (!sessionActive() && !isAuthNeeded()) sessionStart();
if (!sessionActive() && !isAuthNeeded())
sessionStart();
}
HttpResponse AbstractRequestHandler::run()
{
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_;
}

13
src/webui/www/private/login.html

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

Loading…
Cancel
Save