[PS-250] Prevent timeouts less than 1 minute (#802)
* Modified shouldlock functionality to handle the immediately valut timeout * Modified should lock functionality to handle the immediately valut timeout * corrected spelling * check to know when custom minutes in less than 1 * check for minimum allowed minutes * revert vault timeout service * lint fix * check moved to validate method * changed implementation * suggestion fixes * suggestion fixes * fixed comments * changed implementation * changed implementation * made method private
This commit is contained in:
parent
f4066b4f58
commit
7b9826fb28
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue