1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

Added warning when Vault timeout is set to "Never" (#3037)

This commit is contained in:
Rui Tomé 2022-07-07 17:22:37 +01:00 committed by GitHub
parent 97598f5ba4
commit 847d972b0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -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

View File

@ -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."
}
}