diff --git a/angular/src/components/settings/vault-timeout-input.component.ts b/angular/src/components/settings/vault-timeout-input.component.ts index f2fe6d5287..eb6057f275 100644 --- a/angular/src/components/settings/vault-timeout-input.component.ts +++ b/angular/src/components/settings/vault-timeout-input.component.ts @@ -18,7 +18,14 @@ export class VaultTimeoutInputComponent implements ControlValueAccessor, Validat return this.form.get("vaultTimeout").value === VaultTimeoutInputComponent.CUSTOM_VALUE; } + get exceedsMinimumTimout(): boolean { + return ( + !this.showCustom || this.customTimeInMinutes() > VaultTimeoutInputComponent.MIN_CUSTOM_MINUTES + ); + } + static CUSTOM_VALUE = -100; + static MIN_CUSTOM_MINUTES = 0; form = this.formBuilder.group({ vaultTimeout: [null], @@ -132,10 +139,18 @@ export class VaultTimeoutInputComponent implements ControlValueAccessor, Validat return { policyError: true }; } + if (!this.exceedsMinimumTimout) { + return { minTimeoutError: true }; + } + return null; } registerOnValidatorChange(fn: () => void): void { this.validatorChange = fn; } + + private customTimeInMinutes() { + return this.form.get("custom.hours")?.value * 60 + this.form.get("custom.minutes")?.value; + } }