mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 14:12:50 +02:00
add migration of plaintext password to base64
This commit is contained in:
parent
7c6c75c484
commit
fd2ee8ce4e
2 changed files with 27 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": 1.1,
|
||||
"version": 1.2,
|
||||
"settings": [
|
||||
{
|
||||
"name": "metaverse",
|
||||
|
@ -249,7 +249,7 @@
|
|||
"label": "X end",
|
||||
"can_set": true,
|
||||
"placeholder": "16384.0"
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "y_min",
|
||||
"label": "Y start",
|
||||
|
|
|
@ -129,7 +129,9 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
|
|||
// reload the master and user config so that the merged config is right
|
||||
_configMap.loadMasterAndUserConfig(argumentList);
|
||||
}
|
||||
} else if (oldVersion < 1.1) {
|
||||
}
|
||||
|
||||
if (oldVersion < 1.1) {
|
||||
static const QString ENTITY_SERVER_SETTINGS_KEY = "entity_server_settings";
|
||||
static const QString ENTITY_FILE_NAME_KEY = "persistFilename";
|
||||
static const QString ENTITY_FILE_PATH_KEYPATH = ENTITY_SERVER_SETTINGS_KEY + ".persistFilePath";
|
||||
|
@ -165,6 +167,28 @@ void DomainServerSettingsManager::setupConfigMap(const QStringList& argumentList
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
if (oldVersion < 1.2) {
|
||||
// This was prior to the base64 encoding of password for HTTP Basic Authentication.
|
||||
// If we have a password in the previous settings file, make it base 64
|
||||
static const QString BASIC_AUTH_PASSWORD_KEY_PATH { "security.http_password" };
|
||||
|
||||
QVariant* passwordVariant = valueForKeyPath(_configMap.getUserConfig(), BASIC_AUTH_PASSWORD_KEY_PATH);
|
||||
|
||||
if (passwordVariant && passwordVariant->canConvert(QMetaType::QString)) {
|
||||
QString plaintextPassword = passwordVariant->toString();
|
||||
|
||||
qDebug() << "Migrating plaintext password to base64 password in domain-server settings.";
|
||||
|
||||
*passwordVariant = plaintextPassword.toUtf8().toBase64();
|
||||
|
||||
// write the new settings to file
|
||||
persistToFile();
|
||||
|
||||
// reload the master and user config so the merged config is correct
|
||||
_configMap.loadMasterAndUserConfig(argumentList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// write the current description version to our settings
|
||||
|
|
Loading…
Reference in a new issue