mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-30 20:28:05 -06:00
Merge pull request #12004 from Chocobo1/authCount
Add configurable ban options for WebUI
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
|
||||
#include "preferences.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#endif
|
||||
@@ -621,6 +623,26 @@ void Preferences::setWebUIPassword(const QByteArray &password)
|
||||
setValue("Preferences/WebUI/Password_PBKDF2", password);
|
||||
}
|
||||
|
||||
int Preferences::getWebUIMaxAuthFailCount() const
|
||||
{
|
||||
return value("Preferences/WebUI/MaxAuthenticationFailCount", 5).toInt();
|
||||
}
|
||||
|
||||
void Preferences::setWebUIMaxAuthFailCount(const int count)
|
||||
{
|
||||
setValue("Preferences/WebUI/MaxAuthenticationFailCount", count);
|
||||
}
|
||||
|
||||
std::chrono::seconds Preferences::getWebUIBanDuration() const
|
||||
{
|
||||
return std::chrono::seconds {value("Preferences/WebUI/BanDuration", 3600).toInt()};
|
||||
}
|
||||
|
||||
void Preferences::setWebUIBanDuration(const std::chrono::seconds duration)
|
||||
{
|
||||
setValue("Preferences/WebUI/BanDuration", static_cast<int>(duration.count()));
|
||||
}
|
||||
|
||||
int Preferences::getWebUISessionTimeout() const
|
||||
{
|
||||
return value("Preferences/WebUI/SessionTimeout", 3600).toInt();
|
||||
|
||||
@@ -194,6 +194,10 @@ public:
|
||||
void setWebUiUsername(const QString &username);
|
||||
QByteArray getWebUIPassword() const;
|
||||
void setWebUIPassword(const QByteArray &password);
|
||||
int getWebUIMaxAuthFailCount() const;
|
||||
void setWebUIMaxAuthFailCount(int count);
|
||||
std::chrono::seconds getWebUIBanDuration() const;
|
||||
void setWebUIBanDuration(std::chrono::seconds duration);
|
||||
int getWebUISessionTimeout() const;
|
||||
void setWebUISessionTimeout(int timeout);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user