vendredi 26 octobre 2018

Pattern JavaScript to validate password strength in Angular

form: FormGroup = new FormGroup({
   clave: new FormControl('', [Validators.required, Validators.pattern("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*[0-9])(?=.*[$@$!%*?&\\.\\-\\_])[A-Za-z\d$@$!%*?&\\.\\-\\_].{7,}$")])
});

This pattern validates the strength of a password, regardless of the order in which the conditions are met.

Minimum requirements:

  1. A character in lowercase
  2. A Character in uppercase
  3. A number
  4. A special character
  5. Minimum 8 characters

I hope it will be you useful.

regards.

Aucun commentaire:

Enregistrer un commentaire