diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index d43e8ef..b4b104e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -7,7 +7,6 @@ import { PageAgendaComponent } from './pages/page-agenda/page-agenda.component'; import { PageAjoutContactComponent } from './pages/page-ajout-contact/page-ajout-contact.component'; import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component'; import { PageDashboardComponent } from './pages/page-dashboard/page-dashboard.component'; -import { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component'; import { PageDeleteMemberComponent } from './pages/page-delete-member/page-delete-member.component'; import { PageForgotPasswordComponent } from './pages/page-forgot-password/page-forgot-password.component'; import { PageMenuSemaineComponent } from './pages/page-menu-semaine/page-menu-semaine.component'; @@ -17,11 +16,11 @@ import { PageRepertoireComponent } from './pages/page-repertoire/page-repertoire import { PageResetPasswordComponent } from './pages/page-reset-password/page-reset-password.component'; import { PageSignupComponent } from './pages/page-signup/page-signup.component'; import { PageToDoListComponent } from './pages/page-to-do-list/page-to-do-list.component'; -import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component'; import { PageUpdateMemberComponent } from './pages/page-update-member/page-update-member.component'; import { PageSupportComponent } from './pages/page-support/page-support.component'; import { FooterComponent } from './components/footer/footer.component'; import { AuthGuard } from './auth.guard'; +import { PageAjoutEvenementsComponent } from './pages/page-ajout-evenements/page-ajout-evenements.component'; const routes: Routes = [ { path: '', redirectTo: 'accueil', pathMatch: 'full' }, @@ -32,7 +31,6 @@ const routes: Routes = [ { path: 'agenda', canActivate: [AuthGuard], component: PageAgendaComponent }, { path: 'tableau-de-bord', canActivate: [AuthGuard], component: PageDashboardComponent }, { path: 'supprimer-membre', canActivate: [AuthGuard], component: PageDeleteMemberComponent }, - { path: 'supprimer-compte', canActivate: [AuthGuard], component: PageDeleteAccountComponent }, { path: 'password-oublie', component: PageForgotPasswordComponent }, { path: 'menu', canActivate: [AuthGuard], component: PageMenuSemaineComponent }, { path: 'repertoire', canActivate: [AuthGuard], component: PageRepertoireComponent }, @@ -40,11 +38,11 @@ const routes: Routes = [ { path: 'creation-compte', component: PageSignupComponent }, { path: 'page-support', component: PageSupportComponent}, { path: 'to-do-list', canActivate: [AuthGuard], component: PageToDoListComponent }, - { path: 'modifier-membre', canActivate: [AuthGuard], component: PageUpdateMemberComponent }, - { path: 'modifier-compte', canActivate: [AuthGuard], component: PageUpdateAccountComponent }, + { path: 'modifier-membre/:id', canActivate: [AuthGuard], component: PageUpdateMemberComponent }, { path: 'ajouter-contact', canActivate: [AuthGuard], component: PageAjoutContactComponent }, { path: 'creation-team', canActivate: [AuthGuard], component: PageCreationTeamComponent }, { path: 'footer', component: FooterComponent}, + { path: 'ajout-evenement', canActivate: [AuthGuard], component: PageAjoutEvenementsComponent }, { path: '**', component: PageNotFoundComponent }, ]; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2ea2f43..31e7e57 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -23,10 +23,8 @@ import { MeteoComponent } from './components/meteo/meteo.component'; import { CalendrierComponent } from './components/calendrier/calendrier.component'; import { CardMemberComponent } from './components/card-member/card-member.component'; import { ToDoListComponent } from './components/to-do-list/to-do-list.component'; -import { TacheComponent } from './components/tache/tache.component'; import { CardMenuComponent } from './components/card-menu/card-menu.component'; import { FicheContactComponent } from './components/fiche-contact/fiche-contact.component'; -import { PaginationComponent } from './components/pagination/pagination.component'; import { CreneauComponent } from './components/creneau/creneau.component'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; @@ -35,8 +33,6 @@ import { PageModifierContactComponent } from './pages/page-modifier-contact/page import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component'; import { AutofocusFixModule } from 'ngx-autofocus-fix'; import { FooterComponent } from './components/footer/footer.component'; -import { PageDeleteAccountComponent } from './pages/page-delete-account/page-delete-account.component'; -import { PageUpdateAccountComponent } from './pages/page-update-account/page-update-account.component'; import { DayPilot, DayPilotModule } from "@daypilot/daypilot-lite-angular"; import { registerLocaleData } from '@angular/common'; import localeFr from '@angular/common/locales/fr'; @@ -44,6 +40,7 @@ import { CardAvatarComponent } from './components/card-avatar/card-avatar.compon import { HumeurComponent } from './components/humeur/humeur.component'; import { DeconnexionComponent } from './components/deconnexion/deconnexion.component'; import { AlertComponent } from './components/alert/alert.component'; +import { PageAjoutEvenementsComponent } from './pages/page-ajout-evenements/page-ajout-evenements.component'; registerLocaleData(localeFr) @NgModule({ @@ -70,21 +67,18 @@ registerLocaleData(localeFr) CalendrierComponent, CardMemberComponent, ToDoListComponent, - TacheComponent, CardMenuComponent, FicheContactComponent, - PaginationComponent, CreneauComponent, PageAjoutContactComponent, PageModifierContactComponent, PageCreationTeamComponent, FooterComponent, - PageDeleteAccountComponent, - PageUpdateAccountComponent, CardAvatarComponent, DeconnexionComponent, HumeurComponent, - AlertComponent + AlertComponent, + PageAjoutEvenementsComponent ], imports: [ BrowserModule, 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-avatar/card-avatar.component.html b/src/app/components/card-avatar/card-avatar.component.html index 4591621..d6969cb 100644 --- a/src/app/components/card-avatar/card-avatar.component.html +++ b/src/app/components/card-avatar/card-avatar.component.html @@ -1,13 +1,12 @@ -