diff --git a/src/app/signup/core/customValidationModule.ts b/src/app/signup/core/customValidationModule.ts deleted file mode 100644 index 88be80ef2135470dd5b9b3fd6eec932a0c570d5b..0000000000000000000000000000000000000000 --- a/src/app/signup/core/customValidationModule.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { FormGroup, FormControl, FormGroupDirective, NgForm, ValidatorFn } from '@angular/forms'; -import { ErrorStateMatcher } from '@angular/material'; - -//from https://obsessiveprogrammer.com/validating-confirmation-fields-in-angular-reactive-forms-with-angular-material/ - -/** - * Custom validator functions for reactive form validation - */ -export class CustomValidators { - /** - * Validates that child controls in the form group are equal - */ - static childrenEqual: ValidatorFn = (formGroup: FormGroup) => { - const [firstControlName, ...otherControlNames] = Object.keys(formGroup.controls || {}); - const isValid = otherControlNames.every(controlName => formGroup.get(controlName).value === formGroup.get(firstControlName).value); - return isValid ? null : { childrenNotEqual: true }; - } -} - -/** - * Custom ErrorStateMatcher which returns true (error exists) when the parent form group is invalid and the control has been touched - */ -export class ConfirmValidParentMatcher implements ErrorStateMatcher { - isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean { - return control.parent.invalid && control.touched; - } -} - -/** -* Collection of reusable RegExps -*/ -// export const regExps: { [key: string]: RegExp } = { -// password: /^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{7,15}$/ -// }; - -/** - * Collection of reusable error messages - */ -export const errorMessages: { [key: string]: string } = { - fullName: 'Full name must be between 1 and 128 characters', - email: 'La forme de l\'adresse email doit être valide (username@domain)', - confirmEmail: 'Les adresses email doivent être identiques', - // password: 'Password must be between 7 and 15 characters, and contain at least one number and special character', - confirmPassword: 'Les mots de passe doivent être identiques' -}; \ No newline at end of file