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 }[];
|
vaultTimeouts: { name: string; value: number }[];
|
||||||
localeOptions: any[];
|
localeOptions: any[];
|
||||||
themeOptions: any[];
|
themeOptions: any[];
|
||||||
|
static MIN_CUSTOM_MINUTES = 1;
|
||||||
|
|
||||||
vaultTimeout: FormControl = new FormControl(null);
|
vaultTimeout: FormControl = new FormControl(null);
|
||||||
|
|
||||||
@@ -37,7 +38,6 @@ export class PreferencesComponent implements OnInit {
|
|||||||
private messagingService: MessagingService
|
private messagingService: MessagingService
|
||||||
) {
|
) {
|
||||||
this.vaultTimeouts = [
|
this.vaultTimeouts = [
|
||||||
{ name: i18nService.t("immediately"), value: 0 },
|
|
||||||
{ name: i18nService.t("oneMinute"), value: 1 },
|
{ name: i18nService.t("oneMinute"), value: 1 },
|
||||||
{ name: i18nService.t("fiveMinutes"), value: 5 },
|
{ name: i18nService.t("fiveMinutes"), value: 5 },
|
||||||
{ name: i18nService.t("fifteenMinutes"), value: 15 },
|
{ name: i18nService.t("fifteenMinutes"), value: 15 },
|
||||||
@@ -83,6 +83,15 @@ export class PreferencesComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async submit() {
|
async submit() {
|
||||||
|
if (this.vaultTimeout.value < PreferencesComponent.MIN_CUSTOM_MINUTES) {
|
||||||
|
this.platformUtilsService.showToast(
|
||||||
|
"error",
|
||||||
|
null,
|
||||||
|
this.i18nService.t("vaultCustomTimeoutMinimum")
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.vaultTimeout.valid) {
|
if (!this.vaultTimeout.valid) {
|
||||||
this.platformUtilsService.showToast("error", null, this.i18nService.t("vaultTimeoutToLarge"));
|
this.platformUtilsService.showToast("error", null, this.i18nService.t("vaultTimeoutToLarge"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -41,5 +41,11 @@
|
|||||||
<small>{{ "minutes" | i18n }}</small>
|
<small>{{ "minutes" | i18n }}</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<small *ngIf="!validMinutes" class="form-text text-danger">
|
||||||
|
<i class="bwi bwi-error" aria-hidden="true"></i> {{ "vaultCustomTimeoutMinimum" | i18n }}
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<i class="bwi bwi-blocked" aria-hidden="true"></i>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3129,9 +3129,6 @@
|
|||||||
"vaultTimeoutDesc": {
|
"vaultTimeoutDesc": {
|
||||||
"message": "Choose when your vault will timeout and perform the selected action."
|
"message": "Choose when your vault will timeout and perform the selected action."
|
||||||
},
|
},
|
||||||
"immediately": {
|
|
||||||
"message": "Immediately"
|
|
||||||
},
|
|
||||||
"oneMinute": {
|
"oneMinute": {
|
||||||
"message": "1 minute"
|
"message": "1 minute"
|
||||||
},
|
},
|
||||||
@@ -4434,6 +4431,9 @@
|
|||||||
"vaultTimeoutToLarge": {
|
"vaultTimeoutToLarge": {
|
||||||
"message": "Your vault timeout exceeds the restriction set by your organization."
|
"message": "Your vault timeout exceeds the restriction set by your organization."
|
||||||
},
|
},
|
||||||
|
"vaultCustomTimeoutMinimum": {
|
||||||
|
"message": "Minimum custom timeout is 1 minute."
|
||||||
|
},
|
||||||
"disablePersonalVaultExport": {
|
"disablePersonalVaultExport": {
|
||||||
"message": "Disable Personal Vault Export"
|
"message": "Disable Personal Vault Export"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user