fix: settings encryption
This commit is contained in:
parent
16ccd0d35f
commit
025cd555e9
1 changed files with 3 additions and 3 deletions
|
@ -57,7 +57,7 @@ export default abstract class SettingHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
let processedValue = rawValue;
|
let processedValue = rawValue;
|
||||||
if (typeof settingType.type === "string" && settingType.type.includes("/crypt")) {
|
if (typeof settingType.type === "string" && settingType.type.includes("/crypt") && processedValue != "") {
|
||||||
processedValue = CodingHelper.decrypt(APPLICATION_SECRET, processedValue);
|
processedValue = CodingHelper.decrypt(APPLICATION_SECRET, processedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ export default abstract class SettingHelper {
|
||||||
* @param value The value to set
|
* @param value The value to set
|
||||||
*/
|
*/
|
||||||
public static async setSetting<K extends SettingString>(key: K, value: SettingValueMapping[K]): Promise<void> {
|
public static async setSetting<K extends SettingString>(key: K, value: SettingValueMapping[K]): Promise<void> {
|
||||||
if (value === undefined || value === null) {
|
if (value === undefined || value === null || value == "") {
|
||||||
if (key != "mail.password") this.resetSetting(key);
|
if (key != "mail.password") this.resetSetting(key);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ export default abstract class SettingHelper {
|
||||||
newValue = CodingHelper.encrypt(APPLICATION_SECRET, stringValue);
|
newValue = CodingHelper.encrypt(APPLICATION_SECRET, stringValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.settings[key] = stringValue;
|
this.settings[key] = newValue;
|
||||||
const [topic, settingKey] = key.split(".") as [SettingTopic, string];
|
const [topic, settingKey] = key.split(".") as [SettingTopic, string];
|
||||||
|
|
||||||
await SettingCommandHandler.create({
|
await SettingCommandHandler.create({
|
||||||
|
|
Loading…
Add table
Reference in a new issue