From c2091c7961d44f1c60505fe8c99994a6065ebd15 Mon Sep 17 00:00:00 2001 From: Blandine Bajard <83599148+BlandineBajard@users.noreply.github.com> Date: Wed, 2 Mar 2022 09:35:32 +0100 Subject: [PATCH 1/4] localhost8088 --- src/environments/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 0a4331f..90149fd 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - apiUrl: 'http://localhost:8080', + apiUrl: 'http://localhost:8088', tokenKey: 'TOKEN-ORGANIZEE', }; From 7c1eeaca82dbd2aef6b1cf3a2159881706005551 Mon Sep 17 00:00:00 2001 From: AlineRinquin Date: Wed, 2 Mar 2022 14:01:01 +0100 Subject: [PATCH 2/4] variables envoronement --- src/environments/environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 0a4331f..90149fd 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - apiUrl: 'http://localhost:8080', + apiUrl: 'http://localhost:8088', tokenKey: 'TOKEN-ORGANIZEE', }; From d2cd68971347c393675430d6b3653ee40cae4dc3 Mon Sep 17 00:00:00 2001 From: Blandine Bajard <83599148+BlandineBajard@users.noreply.github.com> Date: Wed, 2 Mar 2022 15:57:03 +0100 Subject: [PATCH 3/4] alerte sur menus et comment du code --- src/app/auth.guard.ts | 8 ++-- .../card-menu/card-menu.component.html | 5 ++ .../card-menu/card-menu.component.ts | 46 +++++++++---------- .../deconnexion/deconnexion.component.ts | 2 +- src/app/components/signin/signin.component.ts | 8 ++-- .../page-accueil/page-accueil.component.ts | 2 +- .../page-agenda/page-agenda.component.ts | 14 +++--- .../page-forgot-password.component.ts | 8 ++-- .../page-reset-password.component.ts | 10 ---- src/app/services/auth.interceptor.ts | 1 - src/app/services/auth.service.ts | 7 +-- src/app/services/menus.service.ts | 6 ++- src/app/services/token.service.ts | 10 ++-- 13 files changed, 62 insertions(+), 65 deletions(-) diff --git a/src/app/auth.guard.ts b/src/app/auth.guard.ts index c457e30..f15980b 100644 --- a/src/app/auth.guard.ts +++ b/src/app/auth.guard.ts @@ -19,6 +19,7 @@ export class AuthGuard implements CanActivate { this.tokenKey = environment.tokenKey; } + //s'il n'y a pas de token, le user ne peut pas naviguer sur les url où cette option est activée canActivate( route: ActivatedRouteSnapshot, state: RouterStateSnapshot @@ -35,20 +36,17 @@ export class AuthGuard implements CanActivate { console.log('decodedToken : ', decodedToken); if (decodedToken.exp) { - console.log("Date d'exp decodedToken : ", decodedToken.exp); const dateExp = new Date(decodedToken.exp * 1000); if (new Date() >= dateExp) { - // le token a expiré, je n'autorise pas l'accès + // le token a expiré, je n'autorise pas l'accès et je redirige pour connexion this.router.navigate(['accueil']); return false; } } - - console.log("C'est ok ! "); return true; } else { console.log('You shall not pass !!!!'); - this.router.navigate(['accueil']); // redirection de notre utilisateur vers une url de notre application (dans notre code TS) + this.router.navigate(['accueil']); return false; } } diff --git a/src/app/components/card-menu/card-menu.component.html b/src/app/components/card-menu/card-menu.component.html index 76793e5..5c4b597 100644 --- a/src/app/components/card-menu/card-menu.component.html +++ b/src/app/components/card-menu/card-menu.component.html @@ -58,6 +58,11 @@