70504: New user registration

This commit is contained in:
Yana De Pauw
2020-05-11 17:27:10 +02:00
parent 780b8b7db9
commit f136ea7d4f
24 changed files with 1164 additions and 8 deletions

View File

@@ -0,0 +1,19 @@
import { FormGroup } from '@angular/forms';
/**
* Validator used to confirm that the password and confirmed password value are the same
*/
export function ConfirmedValidator(controlName: string, matchingControlName: string) {
return (formGroup: FormGroup) => {
const control = formGroup.controls[controlName];
const matchingControl = formGroup.controls[matchingControlName];
if (matchingControl.errors && !matchingControl.errors.confirmedValidator) {
return;
}
if (control.value !== matchingControl.value) {
matchingControl.setErrors({confirmedValidator: true});
} else {
matchingControl.setErrors(null);
}
};
}