|
|
@@ -17,6 +17,7 @@ export class EditProfilInfoConnexionComponent implements OnInit {
|
|
|
{}
|
|
|
formGroup: FormGroup;
|
|
|
submitted = false;
|
|
|
+ user = this.element
|
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
@@ -28,13 +29,34 @@ export class EditProfilInfoConnexionComponent implements OnInit {
|
|
|
|
|
|
createForm() {
|
|
|
|
|
|
- let phonenumberregex : RegExp = /^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/;
|
|
|
+ let emailregex: RegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
|
this.formGroup = this.formBuilder.group({
|
|
|
- phonenumber: [Validators.pattern(phonenumberregex)],
|
|
|
- adress:[]
|
|
|
+ email: [null, [Validators.required, Validators.pattern(emailregex)]],
|
|
|
+ password: [null, [Validators.required, this.checkPassword]]
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ checkPassword(control) {
|
|
|
+ let enteredPassword = control.value
|
|
|
+ let passwordCheck = /^(?=.*[A-Z])(?=.*[a-z])(?=.{8,})/;
|
|
|
+ return (!passwordCheck.test(enteredPassword) && enteredPassword) ? { 'requirements': true } : null;
|
|
|
+ }
|
|
|
+
|
|
|
+ getErrorEmail() {
|
|
|
+ return this.formGroup.get('email').hasError('required') ? 'Adresse email requise' :
|
|
|
+ this.formGroup.get('email').hasError('pattern') ? 'Adresse email non valide' : '';
|
|
|
+ }
|
|
|
+
|
|
|
+ getErrorPassword() {
|
|
|
+ return this.formGroup.get('password').hasError('required') ? 'Mot de passe requis' :
|
|
|
+ this.formGroup.get('password').hasError('requirements') ?
|
|
|
+ 'Le mot de passe doit comporter au moins 8 caractères, une lettre majuscule, une lettre majuscule' : '';
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
// login
|
|
|
updateProfil(){
|
|
|
@@ -58,16 +80,6 @@ export class EditProfilInfoConnexionComponent implements OnInit {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-getErrorPhonenumber() {
|
|
|
- return this.formGroup.get('phonenumber').hasError('pattern') ? 'Numéro de téléphone non valide' : '';
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
onConfirm(): void {
|
|
|
// Close the dialog, return true
|