mirror of
https://github.com/bitwarden/browser
synced 2026-02-24 16:43:27 +00:00
add validator
This commit is contained in:
@@ -7,7 +7,13 @@
|
||||
<bit-card>
|
||||
<bit-form-field disableMargin>
|
||||
<bit-label>{{ "length" | i18n }}</bit-label>
|
||||
<input bitInput formControlName="length" type="number" (change)="save('length')" />
|
||||
<input
|
||||
bitInput
|
||||
formControlName="length"
|
||||
type="number"
|
||||
(change)="save('length')"
|
||||
[min]="minLength"
|
||||
/>
|
||||
<bit-hint>{{ lengthBoundariesHint$ | async }}</bit-hint>
|
||||
</bit-form-field>
|
||||
</bit-card>
|
||||
|
||||
@@ -93,6 +93,8 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
|
||||
[Controls.avoidAmbiguous]: [!Generators.password.settings.initial.ambiguous],
|
||||
});
|
||||
|
||||
protected minLength: number;
|
||||
|
||||
private get numbers() {
|
||||
return this.settings.get(Controls.number);
|
||||
}
|
||||
@@ -139,6 +141,8 @@ export class PasswordSettingsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
this.lengthBoundariesHint.next(boundariesHint);
|
||||
|
||||
this.minLength = constraints?.minLength?.min ?? 5;
|
||||
|
||||
// skips reactive event emissions to break a subscription cycle
|
||||
this.settings.patchValue(state, { emitEvent: false });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user