#6760 Added fix to keep the key in config if the new config doesn't contain one

This commit is contained in:
Jamie Newbon 2020-09-10 13:30:33 +01:00
parent 4c5e5eddc5
commit 5fd2130428

View file

@ -238,7 +238,6 @@ void AppConfig::loadSettings()
m_ActivateEmail = loadSetting(kActivateEmail, "").toString();
m_CryptoEnabled = loadSetting(kCryptoEnabled, true).toBool();
m_AutoHide = loadSetting(kAutoHide, false).toBool();
m_Serialkey = loadSetting(kSerialKey, "").toString().trimmed();
m_lastVersion = loadSetting(kLastVersion, "Unknown").toString();
m_LastExpiringWarningTime = loadSetting(kLastExpireWarningTime, 0).toInt();
m_ActivationHasRun = loadSetting(kActivationHasRun, false).toBool();
@ -251,6 +250,16 @@ void AppConfig::loadSettings()
m_ClientGroupChecked = loadSetting(kGroupClientCheck, true).toBool();
m_ServerHostname = loadSetting(kServerHostname).toString();
//only change the serial key if the settings being loaded contains a key
bool updateSerial = GUI::Config::ConfigWriter::make()
->hasSetting(settingName(kLoadSystemSettings),GUI::Config::ConfigWriter::kCurrent);
//if the setting exists and is not empty
updateSerial = updateSerial && !loadSetting(kSerialKey, "").toString().trimmed().isEmpty();
if (updateSerial) {
m_Serialkey = loadSetting(kSerialKey, "").toString().trimmed();
}
//Set the default path of the TLS certificate file in the users DIR
QString certificateFilename = QString("%1/%2/%3").arg(m_CoreInterface.getProfileDir(),
"SSL",