mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:25:18 +00:00
UI: Load password from registry when "Check Password on Uninstalll" enabled
This commit is contained in:
parent
38bab5969d
commit
8cc04a5f22
@ -328,6 +328,19 @@ void FortSettings::readConfIni(FirewallConf &conf) const
|
||||
conf.setActivePeriodFrom(DateUtil::reformatTime(iniText("activePeriodFrom")));
|
||||
conf.setActivePeriodTo(DateUtil::reformatTime(iniText("activePeriodTo")));
|
||||
ini()->endGroup();
|
||||
|
||||
// Ini Options
|
||||
{
|
||||
const IniOptions &ini = conf.ini();
|
||||
|
||||
// Password
|
||||
if (ini.checkPasswordOnUninstall()) {
|
||||
const QString regPasswordHash = StartupUtil::registryPasswordHash();
|
||||
if (!regPasswordHash.isEmpty()) {
|
||||
setCacheValue(passwordHashKey(), regPasswordHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FortSettings::writeConfIni(const FirewallConf &conf)
|
||||
@ -362,6 +375,7 @@ void FortSettings::writeConfIni(const FirewallConf &conf)
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// Ini Options
|
||||
if (conf.iniEdited()) {
|
||||
const IniOptions &ini = conf.ini();
|
||||
|
||||
|
@ -13,8 +13,10 @@ class FortSettings : public Settings
|
||||
public:
|
||||
explicit FortSettings(QObject *parent = nullptr);
|
||||
|
||||
QString passwordHash() const { return iniText("base/passwordHash"); }
|
||||
void setPasswordHash(const QString &v) { setIniValue("base/passwordHash", v); }
|
||||
static QString passwordHashKey() { return "base/passwordHash"; }
|
||||
|
||||
QString passwordHash() const { return iniText(passwordHashKey()); }
|
||||
void setPasswordHash(const QString &v) { setIniValue(passwordHashKey(), v); }
|
||||
|
||||
bool isDefaultProfilePath() const { return m_isDefaultProfilePath; }
|
||||
bool noCache() const { return m_noCache; }
|
||||
|
@ -282,11 +282,20 @@ void StartupUtil::setExplorerIntegrated(bool integrate)
|
||||
}
|
||||
}
|
||||
|
||||
QString StartupUtil::registryPasswordHash()
|
||||
{
|
||||
const RegKey regApp(RegKey::HKLM, R"(SOFTWARE)");
|
||||
|
||||
const RegKey reg(regApp, APP_NAME);
|
||||
|
||||
return reg.value("passwordHash").toString();
|
||||
}
|
||||
|
||||
void StartupUtil::setRegistryPasswordHash(const QString &passwordHash)
|
||||
{
|
||||
const bool isAdding = !passwordHash.isEmpty();
|
||||
|
||||
RegKey regApp(RegKey::HKLM, R"(SOFTWARE)",
|
||||
const RegKey regApp(RegKey::HKLM, R"(SOFTWARE)",
|
||||
isAdding ? RegKey::DefaultCreate : RegKey::DefaultReadWrite);
|
||||
|
||||
RegKey reg(regApp, APP_NAME, RegKey::DefaultCreate);
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
static bool isExplorerIntegrated();
|
||||
static void setExplorerIntegrated(bool integrate);
|
||||
|
||||
static QString registryPasswordHash();
|
||||
static void setRegistryPasswordHash(const QString &passwordHash);
|
||||
|
||||
static void setPortable(bool portable);
|
||||
|
Loading…
Reference in New Issue
Block a user