diff --git a/apps/desktop/src/app/accounts/settings.component.ts b/apps/desktop/src/app/accounts/settings.component.ts index d8ef021155c..2a02746788c 100644 --- a/apps/desktop/src/app/accounts/settings.component.ts +++ b/apps/desktop/src/app/accounts/settings.component.ts @@ -68,6 +68,8 @@ export class SettingsComponent implements OnInit { currentUserEmail: string; + previousVaultTimeout: number = null; + constructor( private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, @@ -173,6 +175,7 @@ export class SettingsComponent implements OnInit { // Security this.vaultTimeout.setValue(await this.stateService.getVaultTimeout()); this.vaultTimeoutAction = await this.stateService.getVaultTimeoutAction(); + this.previousVaultTimeout = this.vaultTimeout.value; this.vaultTimeout.valueChanges.pipe(debounceTime(500)).subscribe(() => { this.saveVaultTimeoutOptions(); }); @@ -195,6 +198,20 @@ export class SettingsComponent implements OnInit { } async saveVaultTimeoutOptions() { + if (this.vaultTimeout.value == null) { + const confirmed = await this.platformUtilsService.showDialog( + this.i18nService.t("neverLockWarning"), + "", + this.i18nService.t("yes"), + this.i18nService.t("cancel"), + "warning" + ); + if (!confirmed) { + this.vaultTimeout.setValue(this.previousVaultTimeout); + return; + } + } + if (this.vaultTimeoutAction === "logOut") { const confirmed = await this.platformUtilsService.showDialog( this.i18nService.t("vaultTimeoutLogOutConfirmation"), @@ -223,6 +240,8 @@ export class SettingsComponent implements OnInit { return; } + this.previousVaultTimeout = this.vaultTimeout.value; + await this.vaultTimeoutService.setVaultTimeoutOptions( this.vaultTimeout.value, this.vaultTimeoutAction diff --git a/apps/desktop/src/locales/en/messages.json b/apps/desktop/src/locales/en/messages.json index 23fbbbb77a2..94c44b53eb1 100644 --- a/apps/desktop/src/locales/en/messages.json +++ b/apps/desktop/src/locales/en/messages.json @@ -1963,5 +1963,8 @@ }, "apiKey": { "message": "API Key" + }, + "neverLockWarning": { + "message": "Are you sure you want to use the \"Never\" option? Setting your lock options to \"Never\" stores your vault's encryption key on your device. If you use this option you should ensure that you keep your device properly protected." } }