enable password on invite or reset
This commit is contained in:
parent
ddb460f8d0
commit
0ea12eaafc
8 changed files with 61 additions and 32 deletions
|
@ -56,12 +56,17 @@ export default abstract class SettingHelper {
|
|||
return rawValue as unknown as SettingValueMapping[K];
|
||||
}
|
||||
|
||||
let processedValue = rawValue;
|
||||
if (typeof settingType.type === "string" && settingType.type.includes("/crypt")) {
|
||||
processedValue = CodingHelper.decrypt(APPLICATION_SECRET, processedValue);
|
||||
}
|
||||
|
||||
const baseType =
|
||||
typeof settingType.type === "string"
|
||||
? (settingType.type.split("/")[0] as SettingTypeAtom)
|
||||
: (settingType.type as SettingTypeAtom);
|
||||
|
||||
return this.converters[baseType].fromString(rawValue) as unknown as SettingValueMapping[K];
|
||||
return this.converters[baseType].fromString(processedValue) as unknown as SettingValueMapping[K];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,11 +86,11 @@ export default abstract class SettingHelper {
|
|||
const settingType = settingsType[key];
|
||||
this.validateSetting(key, stringValue);
|
||||
|
||||
const oldValue = this.getSetting(key);
|
||||
let finalValue = stringValue;
|
||||
const oldValue = cloneDeep(this.settings[key]);
|
||||
let newValue = stringValue;
|
||||
|
||||
if (typeof settingType.type === "string" && settingType.type.includes("/crypt")) {
|
||||
finalValue = CodingHelper.encrypt(APPLICATION_SECRET, stringValue);
|
||||
newValue = CodingHelper.encrypt(APPLICATION_SECRET, stringValue);
|
||||
}
|
||||
|
||||
this.settings[key] = stringValue;
|
||||
|
@ -94,10 +99,9 @@ export default abstract class SettingHelper {
|
|||
await SettingCommandHandler.create({
|
||||
topic,
|
||||
key: settingKey,
|
||||
value: finalValue,
|
||||
value: newValue,
|
||||
});
|
||||
|
||||
const newValue = this.getSetting(key);
|
||||
this.notifyListeners(key, newValue, oldValue);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue