mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
Reduce sensitive data instances
There is no reason for `WebUI` class to retain this information. PR #21373.
This commit is contained in:
parent
50acb670b0
commit
fd311fd5ff
2 changed files with 11 additions and 6 deletions
|
@ -42,7 +42,7 @@
|
||||||
|
|
||||||
WebUI::WebUI(IApplication *app, const QByteArray &tempPasswordHash)
|
WebUI::WebUI(IApplication *app, const QByteArray &tempPasswordHash)
|
||||||
: ApplicationComponent(app)
|
: ApplicationComponent(app)
|
||||||
, m_passwordHash {tempPasswordHash}
|
, m_tempPasswordHash {tempPasswordHash}
|
||||||
{
|
{
|
||||||
configure();
|
configure();
|
||||||
connect(Preferences::instance(), &Preferences::changed, this, &WebUI::configure);
|
connect(Preferences::instance(), &Preferences::changed, this, &WebUI::configure);
|
||||||
|
@ -54,12 +54,17 @@ void WebUI::configure()
|
||||||
m_errorMsg.clear();
|
m_errorMsg.clear();
|
||||||
|
|
||||||
const Preferences *pref = Preferences::instance();
|
const Preferences *pref = Preferences::instance();
|
||||||
|
|
||||||
m_isEnabled = pref->isWebUIEnabled();
|
m_isEnabled = pref->isWebUIEnabled();
|
||||||
const QString username = pref->getWebUIUsername();
|
const QString username = pref->getWebUIUsername();
|
||||||
if (const QByteArray passwordHash = pref->getWebUIPassword(); !passwordHash.isEmpty())
|
QByteArray passwordHash = m_tempPasswordHash;
|
||||||
m_passwordHash = passwordHash;
|
if (const QByteArray prefPasswordHash = pref->getWebUIPassword(); !prefPasswordHash.isEmpty())
|
||||||
|
{
|
||||||
|
passwordHash = prefPasswordHash;
|
||||||
|
m_tempPasswordHash.clear();
|
||||||
|
}
|
||||||
|
|
||||||
if (m_isEnabled && (username.isEmpty() || m_passwordHash.isEmpty()))
|
if (m_isEnabled && (username.isEmpty() || passwordHash.isEmpty()))
|
||||||
{
|
{
|
||||||
setError(tr("Credentials are not set"));
|
setError(tr("Credentials are not set"));
|
||||||
}
|
}
|
||||||
|
@ -98,7 +103,7 @@ void WebUI::configure()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_webapp->setUsername(username);
|
m_webapp->setUsername(username);
|
||||||
m_webapp->setPasswordHash(m_passwordHash);
|
m_webapp->setPasswordHash(passwordHash);
|
||||||
|
|
||||||
if (pref->isWebUIHttpsEnabled())
|
if (pref->isWebUIHttpsEnabled())
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,5 +77,5 @@ private:
|
||||||
QPointer<Net::DNSUpdater> m_dnsUpdater;
|
QPointer<Net::DNSUpdater> m_dnsUpdater;
|
||||||
QPointer<WebApplication> m_webapp;
|
QPointer<WebApplication> m_webapp;
|
||||||
|
|
||||||
QByteArray m_passwordHash;
|
QByteArray m_tempPasswordHash;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue