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:
@@ -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;
|
||||
|
||||
@@ -41,5 +41,11 @@
|
||||
<small>{{ "minutes" | i18n }}</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<small *ngIf="!validMinutes" class="form-text text-danger">
|
||||
<i class="bwi bwi-error" aria-hidden="true"></i> {{ "vaultCustomTimeoutMinimum" | i18n }}
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<i class="bwi bwi-blocked" aria-hidden="true"></i>
|
||||
</div>
|
||||
|
||||
@@ -3129,9 +3129,6 @@
|
||||
"vaultTimeoutDesc": {
|
||||
"message": "Choose when your vault will timeout and perform the selected action."
|
||||
},
|
||||
"immediately": {
|
||||
"message": "Immediately"
|
||||
},
|
||||
"oneMinute": {
|
||||
"message": "1 minute"
|
||||
},
|
||||
@@ -4434,6 +4431,9 @@
|
||||
"vaultTimeoutToLarge": {
|
||||
"message": "Your vault timeout exceeds the restriction set by your organization."
|
||||
},
|
||||
"vaultCustomTimeoutMinimum": {
|
||||
"message": "Minimum custom timeout is 1 minute."
|
||||
},
|
||||
"disablePersonalVaultExport": {
|
||||
"message": "Disable Personal Vault Export"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user