mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
refactor: validators
This commit is contained in:
parent
fdb54989b0
commit
bf3911af76
2 changed files with 12 additions and 37 deletions
|
@ -25,48 +25,13 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-group" *ngIf="form.controls.enableHeaderAuth.value">
|
||||
<label for="headerAuthVariable" class="control-label">Header Authentication Variable</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="headerAuthVariable" name="headerAuthVariable" formControlName="headerAuthVariable">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <hr/>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="requiredDigit" name="requiredDigit" formControlName="requiredDigit">
|
||||
<label for="requiredDigit">Require a digit in the password</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="requiredLength" class="control-label">Required password length</label>
|
||||
<div>
|
||||
<input type="text" class="form-control form-control-custom " id="requiredLength" name="requiredLength" formControlName="requiredLength">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="requiredLowercase" name="requiredLowercase" formControlName="requiredLowercase">
|
||||
<label for="requiredLowercase">Require a lowercase character in the password</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="requireNonAlphanumeric" name="requireNonAlphanumeric" formControlName="requireNonAlphanumeric">
|
||||
<label for="requireNonAlphanumeric">Require a NonAlphanumeric character in the password</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" id="requireUppercase" name="requireUppercase" formControlName="requireUppercase">
|
||||
<label for="requireUppercase">Require a uppercase character in the password</label>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group">
|
||||
<div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit } from "@angular/core";
|
||||
import { FormBuilder, FormGroup } from "@angular/forms";
|
||||
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
|
||||
|
||||
import { NotificationService } from "../../services";
|
||||
import { SettingsService } from "../../services";
|
||||
|
@ -29,7 +29,17 @@ export class AuthenticationComponent implements OnInit {
|
|||
enableHeaderAuth: [x.enableHeaderAuth],
|
||||
headerAuthVariable: [x.headerAuthVariable],
|
||||
});
|
||||
this.form.controls.enableHeaderAuth.valueChanges.subscribe(x => {
|
||||
if (x) {
|
||||
this.form.get("headerAuthVariable").setValidators(Validators.required);
|
||||
} else {
|
||||
this.form.get("headerAuthVariable").clearValidators();
|
||||
}
|
||||
this.form.get("headerAuthVariable").updateValueAndValidity();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public onSubmit(form: FormGroup) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue