From 3e6bb7bff719f2c768c8ddf939cc63089a8f7776 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Thu, 3 Aug 2023 00:33:18 +0200 Subject: [PATCH] Fixing enforced user loading. Fixes #677 --- src/common/config/private/Config.ts | 3 +++ src/common/config/private/PrivateConfig.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/config/private/Config.ts b/src/common/config/private/Config.ts index 4a5a02ea..afeb4177 100644 --- a/src/common/config/private/Config.ts +++ b/src/common/config/private/Config.ts @@ -56,6 +56,9 @@ const isTesting = ['afterEach', 'after', 'beforeEach', 'before', 'describe', 'it uc.encrypted = !!uc.encryptedPassword; changed = true; } + if (!uc.encrypted && !uc.password) { + throw new Error('Password error for enforced user: ' + uc.name); + } } if (changed) { config.saveSync(); diff --git a/src/common/config/private/PrivateConfig.ts b/src/common/config/private/PrivateConfig.ts index 8c8aa6e5..0b14f8f1 100644 --- a/src/common/config/private/PrivateConfig.ts +++ b/src/common/config/private/PrivateConfig.ts @@ -183,7 +183,6 @@ export class UserConfig { @ConfigProperty({ type: 'string', - constraint: {assert: (val: string, config) => !!val, assertReason: 'Password cant be empty'}, tags: { name: $localize`Password`, @@ -193,6 +192,7 @@ export class UserConfig { description: $localize`Unencrypted, temporary password. App will encrypt it and delete this.` }) password: string; + @ConfigProperty({ tags: {