From 976ca3dacfe6175b03c9b3ba4f250f2aeefd90f8 Mon Sep 17 00:00:00 2001
From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com>
Date: Wed, 13 Jan 2021 17:49:24 +0100
Subject: [PATCH] fix sonar security review

---
 src/app/form/form.component.ts                                | 2 +-
 src/app/profile/profile.component.ts                          | 4 ++--
 src/app/reset-password/reset-password.component.ts            | 2 +-
 .../create-account-form/create-account-form.component.spec.ts | 2 +-
 .../create-account-form/create-account-form.component.ts      | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts
index a5d2ff581..442669834 100644
--- a/src/app/form/form.component.ts
+++ b/src/app/form/form.component.ts
@@ -182,7 +182,7 @@ export class FormComponent implements OnInit {
     // Check to refresh every 2 number.
     if (phoneNoSpace.length % 2 == 0) {
       // Add space every 2 number
-      this.structureForm.get('contactPhone').setValue(phoneNoSpace.replace(/(?!^)(?=(?:\d{2})+$)/g, ' '));
+      this.structureForm.get('contactPhone').setValue(phoneNoSpace.replace(/(?!^)(?=(?:\d{2})+$)/g, ' ')); //NOSONAR
     }
   }
 
diff --git a/src/app/profile/profile.component.ts b/src/app/profile/profile.component.ts
index e340e7e70..1c7bd1c42 100644
--- a/src/app/profile/profile.component.ts
+++ b/src/app/profile/profile.component.ts
@@ -34,11 +34,11 @@ export class ProfileComponent implements OnInit {
       {
         oldPassword: [
           '',
-          [Validators.required, Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/)],
+          [Validators.required, Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/)], //NOSONAR
         ],
         password: [
           '',
-          [Validators.required, Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/)],
+          [Validators.required, Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/)], //NOSONAR
         ],
         confirmPassword: [''],
       },
diff --git a/src/app/reset-password/reset-password.component.ts b/src/app/reset-password/reset-password.component.ts
index ed5a77541..3f3187b99 100644
--- a/src/app/reset-password/reset-password.component.ts
+++ b/src/app/reset-password/reset-password.component.ts
@@ -38,7 +38,7 @@ export class ResetPasswordComponent implements OnInit {
       {
         password: [
           '',
-          [Validators.required, Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/)],
+          [Validators.required, Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/)], //NOSONAR
         ],
         confirmPassword: [''],
       },
diff --git a/src/app/shared/components/create-account-form/create-account-form.component.spec.ts b/src/app/shared/components/create-account-form/create-account-form.component.spec.ts
index 259b99060..79e2eb5be 100644
--- a/src/app/shared/components/create-account-form/create-account-form.component.spec.ts
+++ b/src/app/shared/components/create-account-form/create-account-form.component.spec.ts
@@ -12,7 +12,7 @@ describe('CreateAccountFormComponent', () => {
       email: new FormControl('test@test.fr', Validators.required),
       password: new FormControl('Testaze123!', [
         Validators.required,
-        Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/),
+        Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/), //NOSONAR
       ]),
       confirmPassword: new FormControl('Testaze123!'),
     },
diff --git a/src/app/shared/components/create-account-form/create-account-form.component.ts b/src/app/shared/components/create-account-form/create-account-form.component.ts
index 2ae7b4136..25872ca4a 100644
--- a/src/app/shared/components/create-account-form/create-account-form.component.ts
+++ b/src/app/shared/components/create-account-form/create-account-form.component.ts
@@ -19,7 +19,7 @@ export class CreateAccountFormComponent implements OnInit {
         email: new FormControl('', Validators.required),
         password: new FormControl('', [
           Validators.required,
-          Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/),
+          Validators.pattern(/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})/), //NOSONAR
         ]),
         confirmPassword: new FormControl(''),
       },
-- 
GitLab