1
0
mirror of https://github.com/bitwarden/web synced 2025-12-23 19:53:16 +00:00

do not allow timeout less than 1 minute

This commit is contained in:
gbubemismith
2022-05-25 01:01:37 +01:00
parent 323642c2f5
commit a4ff1bb8b4
3 changed files with 19 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ export class PreferencesComponent implements OnInit {
vaultTimeouts: { name: string; value: number }[];
localeOptions: any[];
themeOptions: any[];
static MIN_CUSTOM_MINUTES = 1;
vaultTimeout: FormControl = new FormControl(null);
@@ -37,7 +38,6 @@ export class PreferencesComponent implements OnInit {
private messagingService: MessagingService
) {
this.vaultTimeouts = [
{ name: i18nService.t("immediately"), value: 0 },
{ name: i18nService.t("oneMinute"), value: 1 },
{ name: i18nService.t("fiveMinutes"), value: 5 },
{ name: i18nService.t("fifteenMinutes"), value: 15 },
@@ -83,6 +83,15 @@ export class PreferencesComponent implements OnInit {
}
async submit() {
if (this.vaultTimeout.value < PreferencesComponent.MIN_CUSTOM_MINUTES) {
this.platformUtilsService.showToast(
"error",
null,
this.i18nService.t("vaultCustomTimeoutMinimum")
);
return;
}
if (!this.vaultTimeout.valid) {
this.platformUtilsService.showToast("error", null, this.i18nService.t("vaultTimeoutToLarge"));
return;