Skip to content

Instantly share code, notes, and snippets.

@djabif
Last active February 28, 2023 12:38
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save djabif/c4a75465231460fb158e55d358bc924a to your computer and use it in GitHub Desktop.
Save djabif/c4a75465231460fb158e55d358bc924a to your computer and use it in GitHub Desktop.
Ionic Password validator
import { PasswordValidator } from '../../validators/password.validator';
this.matching_passwords_group = new FormGroup({
password: new FormControl('', Validators.compose([
Validators.minLength(5),
Validators.required,
Validators.pattern('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9]+$') //this is for the letters (both uppercase and lowercase) and numbers validation
])),
confirm_password: new FormControl('', Validators.required)
}, (formGroup: FormGroup) => {
return PasswordValidator.areEqual(formGroup);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment