mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 05:48:47 +03:00
Fix status returned to banned user.
This commit is contained in:
parent
6f14b34470
commit
651bf4f9aa
2 changed files with 22 additions and 12 deletions
|
@ -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();
|
||||||
|
|
||||||
|
if (isBanned())
|
||||||
|
{
|
||||||
|
status(403, "Forbidden");
|
||||||
|
print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
processRequest();
|
processRequest();
|
||||||
|
}
|
||||||
|
|
||||||
return response_;
|
return response_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.") {
|
||||||
|
|
Loading…
Reference in a new issue