From 9abf80662bcbfdeba1c6b0b1260689995aeb5c98 Mon Sep 17 00:00:00 2001 From: Yassine R Date: Tue, 28 Nov 2023 21:59:22 +0100 Subject: [PATCH] fix(cgu): add privacy policy --- .talismanrc | 8 ++++-- .../db/dumps/domifa_test.postgres.custom.gz | Bin 91692 -> 91820 bytes ...domifa_test.postgres.restore-data-only.sql | 10 +++---- ...st.postgres.truncate-restore-data-only.sql | 10 +++---- .../1700663362619-auto-migration.ts | 13 +++++++-- .../1603812391580-pr-env-create-database.ts | 1 + .../portail-usagers-login.controller.ts | 10 +++---- packages/frontend/src/app/app.component.ts | 17 ++++++++++++ packages/frontend/src/app/app.module.ts | 5 ++-- .../frontend/src/app/guards/admin.guard.ts | 4 +-- .../frontend/src/app/guards/auth.guard.ts | 3 +- .../guards/can-edit-portail-usager.guard.ts | 4 +-- .../src/app/guards/can-edit-sms.guard.ts | 4 +-- .../frontend/src/app/guards/facteur.guard.ts | 4 +-- .../frontend/src/app/guards/logged.guard.ts | 4 +-- .../src/app/guards/responsable.guard.ts | 4 +-- .../politique/politique.component.html | 18 ++++++++++++ .../politique/politique.component.spec.ts | 14 ++++++---- .../politique/politique.component.ts | 25 ++++++++++++++--- ...ofil-historique-login-portail.component.ts | 1 - .../services/usager-options.service.ts | 1 - .../src/_common/mocks/DEFAULT_USAGER.const.ts | 1 + .../portail-usagers/src/app/app.component.ts | 20 ++++++++++++-- .../portail-usagers/src/app/app.module.ts | 6 ++-- .../src/app/guards/auth-guard.ts | 3 +- .../components/_static/cgu/cgu.component.ts | 7 ++--- .../politique/politique.component.html | 18 ++++++++++++ .../politique/politique.component.spec.ts | 3 ++ .../_static/politique/politique.component.ts | 26 +++++++++++++++--- .../src/app/modules/general/general.module.ts | 2 ++ .../home-usager/home-usager.component.html | 2 +- .../home-usager/home-usager.component.ts | 6 ++++ .../usager-accept-cgu.component.css | 0 .../usager-accept-cgu.component.html | 3 +- .../usager-accept-cgu.component.spec.ts | 2 ++ .../usager-accept-cgu.component.ts | 14 +++++----- .../usager-account-routing.module.ts | 9 +++++- .../usager-account/usager-account.module.ts | 7 +++++ .../services/usager-auth.service.ts | 2 +- .../usager-auth/usager-auth-routing.module.ts | 6 +--- .../modules/usager-auth/usager-auth.module.ts | 5 +--- .../usager-login/usager-login.component.html | 2 +- .../usager-login.component.spec.ts | 2 +- .../usager-login/usager-login.component.ts | 14 +++++----- .../src/app/shared/global-constants.class.ts | 9 ------ 45 files changed, 225 insertions(+), 104 deletions(-) rename packages/portail-usagers/src/app/modules/{usager-auth => usager-account/components}/usager-accept-cgu/usager-accept-cgu.component.css (100%) rename packages/portail-usagers/src/app/modules/{usager-auth => usager-account/components}/usager-accept-cgu/usager-accept-cgu.component.html (98%) rename packages/portail-usagers/src/app/modules/{usager-auth => usager-account/components}/usager-accept-cgu/usager-accept-cgu.component.spec.ts (85%) rename packages/portail-usagers/src/app/modules/{usager-auth => usager-account/components}/usager-accept-cgu/usager-accept-cgu.component.ts (85%) diff --git a/.talismanrc b/.talismanrc index acfd7fad2f..2737ddb368 100644 --- a/.talismanrc +++ b/.talismanrc @@ -1,16 +1,18 @@ fileignoreconfig: - filename: _scripts/db/dumps/domifa_test.postgres.restore-data-only.sql - checksum: 104c8036ca644bc51bb4c797e56b3a5b178a55b1c293a77308844e54ca7c404d + checksum: 8c3fbddbda155e81d1ce861dfa05c391c60199d539272d4013b71ae0100648ea - filename: _scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql - checksum: 9976de417c719ab5c3bec9d4a1bafc40bfa8d4388d2dbd5da7d1ea4a11d2db75 + checksum: 88414b9693efe32632ed9eed749e3cdc4ec5e66030160941e8d9643dfc61ad7b - filename: packages/backend/src/_migrations/1699910877010-auto-migration.ts checksum: bd05dd6b68f7fe2ca36ab1180a0449878cf78f4e048d2e5979b3dbe5fba1db53 - filename: packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts - checksum: 586e3b26481d71256a1b7626956aaf9e68211dfbda527dd862a2aad075b5cc04 + checksum: 4933dc2edd58b0d9ced8906548fec306389d66a0b415b99cd29dc09fdfe76c3b - filename: packages/backend/src/interactions/services/InteractionsDeletor.service.spec.ts checksum: b66659fea19859e55afaf0ed47519f0804857e486b2ecc6b01d5ae96f1a86a0b - filename: packages/portail-usagers/src/app/modules/general/components/_static/cgu/cgu.component.html checksum: 584da8c9b8ebc95d1d996d0201e0e57cf31e05c6704104e7adacba67a7eb4dd7 +- filename: packages/portail-usagers/src/app/modules/usager-auth/services/usager-auth.service.ts + checksum: d55d8d80cec2984b300d93cedc411653bb3c49d172cfb2c66e347ad49c715634 - filename: packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.ts checksum: 189eb0e583dc89e07c097b61b59e3ee952d84b098dd0fd75bc7cd4bc71ab3fa5 - filename: yarn.lock diff --git a/_scripts/db/dumps/domifa_test.postgres.custom.gz b/_scripts/db/dumps/domifa_test.postgres.custom.gz index 3d3b2a55ee4855f300038909097a7a888c1c1660..4260b9426759576b7496dd7333bdf30e90656db1 100644 GIT binary patch delta 3979 zcma)8d0Z4n7M>dJ0bvkvKwv;42w}wTp1#JoB3>MdkSK}=Dk308P*lVV2`gyS7$vpX zDn=IL84Ze+*cy!oaWNW?pvD75FrH|Ps4*HLxIJAp?CyWtfAsI`_rCY)T~*b4&N}Ql z=g>VddT@LqaM##71C5JDc?{N9i1nqnzWhtOzcbvZ0Gf@k1ceSxpOTfD6J-79O-Ibi zoSI3~R5%@``9CN%R)5*BvdFtS_Zn~%%`8XLFhSdjA%ha_c40ANMsMwnT2*eQ(K}B6 z!kDGdZ!QAC;uqm=b}EGv5bY6+G0&q3oljyc@F=7!g{#PF8L80bFD z4{h_kfL&T>w9vmNwzXK$*1++OR{uP0Mh+qORSvI&_AIn7!7QS~dl1Z_vAyFkUkP)U z8HdcXB5ca-idOPxRlhvPLol}sn$@=-w&Pi}zu!}g1s1jp@I}WX{m3_mZbx}zJCQ|g zgSXnbTH~>B8gHePaAvGGIv!)dWDAcP;$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jr~WNh-^p4S)$q9S zyt4bR!&|lMJ5ruZRnHdLQb&z>{TmOVw$f+%tCq;qKmD2h_u=g~`W}?#ZhBFXCc&}; zBY!@USNCrJRj2#zZ;UER;wpCp|1Qsd6wn|=G1H>t`dr^r-tP5NGIoQo=Y1IdIL}BR@I4Ww+enW51l|AzKC7W`c~f?EpfR%srMJuTzk^IXXntZ-g#Tn+<(3qQxsEP bJoxGxYfJZDq-UF@MP{JS(NyhF2DP$IBd diff --git a/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql b/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql index b61809dbcd..b353ca2607 100644 --- a/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql +++ b/_scripts/db/dumps/domifa_test.postgres.restore-data-only.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 14.9 --- Dumped by pg_dump version 14.9 +-- Dumped from database version 14.9 (Debian 14.9-1.pgdg110+1) +-- Dumped by pg_dump version 14.9 (Debian 14.9-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -255,9 +255,9 @@ e0bcefc6-f1be-4c83-ac9d-6ea47335a9c3 2021-03-15 16:53:55.740856+01 2023-09-05 23 -- Data for Name: user_usager; Type: TABLE DATA; Schema: public; Owner: - -- -COPY public.user_usager (uuid, "createdAt", "updatedAt", version, id, "usagerUUID", "structureId", login, password, salt, "isTemporaryPassword", "lastLogin", "passwordLastUpdate", "lastPasswordResetDate", "lastPasswordResetStructureUser", enabled) FROM stdin; -a657f4bd-e4d1-4c38-bdd0-ffd268b356df 2021-10-05 11:34:41.369505+02 2021-11-30 15:02:07.705535+01 18 1 b2c26e55-ab37-457d-b307-6fe161050a9b 1 WKYJBDXS $2a$10$cmwXTghEgrGRYTkGIJlj3Owjo8YVVDXOgceAGtkgzcD2M/Tf3Dhb. $2a$10$/uFyiR8hCe8XkRe7x2fYm. t 2021-11-30 15:02:07.69+01 \N 2021-10-05 11:34:41.365+02 {"userId": 1, "userName": "Patrick Roméro"} t -a03a9a49-ae31-4160-9879-bab02dc46361 2021-11-30 14:50:26.278073+01 2023-11-20 16:40:58.362384+01 17 2 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 LNQIFFBK $2a$10$u..ofvcb5t5a44N0Oriwbew6oz600aoOFzll9yl92Lx1VOb0E8o0a $2a$10$zmuPXxUOuQJ7nE6ag4.x6e f 2023-11-20 16:40:58.36+01 2021-11-30 15:01:39.675+01 2021-11-30 14:50:26.275+01 {"userId": 1, "userName": "Patrick Roméro"} t +COPY public.user_usager (uuid, "createdAt", "updatedAt", version, id, "usagerUUID", "structureId", login, password, salt, "isTemporaryPassword", "lastLogin", "passwordLastUpdate", "lastPasswordResetDate", "lastPasswordResetStructureUser", enabled, "acceptTerms") FROM stdin; +a657f4bd-e4d1-4c38-bdd0-ffd268b356df 2021-10-05 11:34:41.369505+02 2021-11-30 15:02:07.705535+01 18 1 b2c26e55-ab37-457d-b307-6fe161050a9b 1 WKYJBDXS $2a$10$cmwXTghEgrGRYTkGIJlj3Owjo8YVVDXOgceAGtkgzcD2M/Tf3Dhb. $2a$10$/uFyiR8hCe8XkRe7x2fYm. t 2021-11-30 15:02:07.69+01 \N 2021-10-05 11:34:41.365+02 {"userId": 1, "userName": "Patrick Roméro"} t \N +a03a9a49-ae31-4160-9879-bab02dc46361 2021-11-30 14:50:26.278073+01 2023-11-20 16:40:58.362384+01 17 2 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 LNQIFFBK $2a$10$u..ofvcb5t5a44N0Oriwbew6oz600aoOFzll9yl92Lx1VOb0E8o0a $2a$10$zmuPXxUOuQJ7nE6ag4.x6e f 2023-11-20 16:40:58.36+01 2021-11-30 15:01:39.675+01 2021-11-30 14:50:26.275+01 {"userId": 1, "userName": "Patrick Roméro"} t \N \. diff --git a/_scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql b/_scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql index dc93ba61ab..7a58de30e5 100644 --- a/_scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql +++ b/_scripts/db/dumps/domifa_test.postgres.truncate-restore-data-only.sql @@ -28,8 +28,8 @@ TRUNCATE TABLE public.usager_options_history RESTART IDENTITY CASCADE; -- PostgreSQL database dump -- --- Dumped from database version 14.9 --- Dumped by pg_dump version 14.9 +-- Dumped from database version 14.9 (Debian 14.9-1.pgdg110+1) +-- Dumped by pg_dump version 14.9 (Debian 14.9-1.pgdg110+1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -281,9 +281,9 @@ e0bcefc6-f1be-4c83-ac9d-6ea47335a9c3 2021-03-15 16:53:55.740856+01 2023-09-05 23 -- Data for Name: user_usager; Type: TABLE DATA; Schema: public; Owner: - -- -COPY public.user_usager (uuid, "createdAt", "updatedAt", version, id, "usagerUUID", "structureId", login, password, salt, "isTemporaryPassword", "lastLogin", "passwordLastUpdate", "lastPasswordResetDate", "lastPasswordResetStructureUser", enabled) FROM stdin; -a657f4bd-e4d1-4c38-bdd0-ffd268b356df 2021-10-05 11:34:41.369505+02 2021-11-30 15:02:07.705535+01 18 1 b2c26e55-ab37-457d-b307-6fe161050a9b 1 WKYJBDXS $2a$10$cmwXTghEgrGRYTkGIJlj3Owjo8YVVDXOgceAGtkgzcD2M/Tf3Dhb. $2a$10$/uFyiR8hCe8XkRe7x2fYm. t 2021-11-30 15:02:07.69+01 \N 2021-10-05 11:34:41.365+02 {"userId": 1, "userName": "Patrick Roméro"} t -a03a9a49-ae31-4160-9879-bab02dc46361 2021-11-30 14:50:26.278073+01 2023-11-20 16:40:58.362384+01 17 2 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 LNQIFFBK $2a$10$u..ofvcb5t5a44N0Oriwbew6oz600aoOFzll9yl92Lx1VOb0E8o0a $2a$10$zmuPXxUOuQJ7nE6ag4.x6e f 2023-11-20 16:40:58.36+01 2021-11-30 15:01:39.675+01 2021-11-30 14:50:26.275+01 {"userId": 1, "userName": "Patrick Roméro"} t +COPY public.user_usager (uuid, "createdAt", "updatedAt", version, id, "usagerUUID", "structureId", login, password, salt, "isTemporaryPassword", "lastLogin", "passwordLastUpdate", "lastPasswordResetDate", "lastPasswordResetStructureUser", enabled, "acceptTerms") FROM stdin; +a657f4bd-e4d1-4c38-bdd0-ffd268b356df 2021-10-05 11:34:41.369505+02 2021-11-30 15:02:07.705535+01 18 1 b2c26e55-ab37-457d-b307-6fe161050a9b 1 WKYJBDXS $2a$10$cmwXTghEgrGRYTkGIJlj3Owjo8YVVDXOgceAGtkgzcD2M/Tf3Dhb. $2a$10$/uFyiR8hCe8XkRe7x2fYm. t 2021-11-30 15:02:07.69+01 \N 2021-10-05 11:34:41.365+02 {"userId": 1, "userName": "Patrick Roméro"} t \N +a03a9a49-ae31-4160-9879-bab02dc46361 2021-11-30 14:50:26.278073+01 2023-11-20 16:40:58.362384+01 17 2 97b7e840-0e93-4bf4-ba7d-0a406aa898f2 1 LNQIFFBK $2a$10$u..ofvcb5t5a44N0Oriwbew6oz600aoOFzll9yl92Lx1VOb0E8o0a $2a$10$zmuPXxUOuQJ7nE6ag4.x6e f 2023-11-20 16:40:58.36+01 2021-11-30 15:01:39.675+01 2021-11-30 14:50:26.275+01 {"userId": 1, "userName": "Patrick Roméro"} t \N \. diff --git a/packages/backend/src/_migrations/1700663362619-auto-migration.ts b/packages/backend/src/_migrations/1700663362619-auto-migration.ts index 11f9c57d3a..f34ce6d4d7 100644 --- a/packages/backend/src/_migrations/1700663362619-auto-migration.ts +++ b/packages/backend/src/_migrations/1700663362619-auto-migration.ts @@ -1,12 +1,19 @@ import { MigrationInterface, QueryRunner } from "typeorm"; +import { domifaConfig } from "../config"; export class AutoMigration1700663362619 implements MigrationInterface { name = "AutoMigration1700663362619"; public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query( - `ALTER TABLE "user_usager" ADD "acceptTerms" TIMESTAMP WITH TIME ZONE` - ); + if ( + domifaConfig().envId === "preprod" || + domifaConfig().envId === "prod" || + domifaConfig().envId === "local" + ) { + await queryRunner.query( + `ALTER TABLE "user_usager" ADD "acceptTerms" TIMESTAMP WITH TIME ZONE` + ); + } } public async down(queryRunner: QueryRunner): Promise { diff --git a/packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts b/packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts index c026387263..1534dedca0 100644 --- a/packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts +++ b/packages/backend/src/_migrations/_init-db/1603812391580-pr-env-create-database.ts @@ -609,6 +609,7 @@ async function createTables(queryRunner: QueryRunner) { "lastPasswordResetDate" timestamptz NULL, "lastPasswordResetStructureUser" jsonb NULL, enabled bool NOT NULL DEFAULT false, + "acceptTerms" timestamptz NULL, CONSTRAINT "PK_46cd95ba6c330d680e13ce7d932" PRIMARY KEY (uuid), CONSTRAINT "UQ_07ddbb376616a6bf4ffdbb2b6d7" UNIQUE ("usagerUUID"), CONSTRAINT "UQ_547d83b925177cadc602bc7e221" UNIQUE (id), diff --git a/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts b/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts index 5d4ff0404a..c5ce55a65c 100644 --- a/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts +++ b/packages/backend/src/_portail-usager/portail-usager-login/portail-usagers-login.controller.ts @@ -60,17 +60,15 @@ export class PortailUsagersLoginController { usagerUUID: user.usagerUUID, }); - const portailUsagerProfile: PortailUsagerProfile = { usager }; + const portailUsagerProfile: PortailUsagerProfile = { + usager, + acceptTerms: user.acceptTerms, + }; const structure = await structureRepository.findOneByOrFail({ id: user.structureId, }); - console.log({ - usagerUUID: usager.uuid, - structureId: user.structureId, - }); - const lastLogin = await userUsagerLoginRepository.save( new UserUsagerLoginTable({ usagerUUID: usager.uuid, diff --git a/packages/frontend/src/app/app.component.ts b/packages/frontend/src/app/app.component.ts index 2673d7112a..682c5b8793 100644 --- a/packages/frontend/src/app/app.component.ts +++ b/packages/frontend/src/app/app.component.ts @@ -68,11 +68,28 @@ export class AppComponent implements OnInit, OnDestroy { public matomo: MatomoTracker ) { this.apiVersion = localStorage.getItem("version"); + this.submitted = false; this.pendingNews = false; this.loading = false; this.me = null; this.initCguForm(); + this.checkMatomo(); + } + + private checkMatomo() { + if (localStorage.getItem("matomo-opted-in") === null) { + localStorage.setItem("matomo-opted-in", JSON.stringify(true)); + } + + const disableMatomo = + JSON.parse(localStorage.getItem("matomo-opted-in")) === true; + + if (!disableMatomo) { + this.matomo.optUserOut(); + } else { + localStorage.setItem("matomo-opted-in", JSON.stringify(true)); + } } private initCguForm() { diff --git a/packages/frontend/src/app/app.module.ts b/packages/frontend/src/app/app.module.ts index c67635e542..83900fc1e7 100644 --- a/packages/frontend/src/app/app.module.ts +++ b/packages/frontend/src/app/app.module.ts @@ -30,14 +30,13 @@ import { SharedModule } from "./modules/shared/shared.module"; import pkg from "../../package.json"; -import { UserIdleModule } from "angular-user-idle"; - import { createErrorHandler, init } from "@sentry/angular"; import { MATOMO_INJECTORS } from "./shared"; import { StoreModule } from "@ngrx/store"; import { _usagerReducer } from "./shared/store/ngRxAppStore.service"; import { registerLocaleData } from "@angular/common"; import localeFr from "@angular/common/locales/fr"; +import { provideUserIdleConfig } from "angular-user-idle"; const disableAnimations = !("animate" in document.documentElement) || @@ -68,13 +67,13 @@ registerLocaleData(localeFr, "fr"); NgbModule, StoreModule.forRoot({ app: _usagerReducer }), SharedModule, - UserIdleModule.forRoot({ idle: 3600, timeout: 60, ping: 20 }), MATOMO_INJECTORS, ], providers: [ AuthService, LoadingService, CustomToastService, + provideUserIdleConfig({ idle: 3600, timeout: 60, ping: 20 }), { provide: LOCALE_ID, useValue: "fr" }, { provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true }, { diff --git a/packages/frontend/src/app/guards/admin.guard.ts b/packages/frontend/src/app/guards/admin.guard.ts index db5a401a02..d77bd1c925 100644 --- a/packages/frontend/src/app/guards/admin.guard.ts +++ b/packages/frontend/src/app/guards/admin.guard.ts @@ -1,12 +1,12 @@ import { Injectable } from "@angular/core"; -import { CanActivate, Router } from "@angular/router"; +import { Router } from "@angular/router"; import { Observable } from "rxjs"; import { AuthService } from "../modules/shared/services/auth.service"; import { CustomToastService } from "../modules/shared/services/custom-toast.service"; @Injectable({ providedIn: "root" }) -export class AdminGuard implements CanActivate { +export class AdminGuard { constructor( private readonly router: Router, private readonly authService: AuthService, diff --git a/packages/frontend/src/app/guards/auth.guard.ts b/packages/frontend/src/app/guards/auth.guard.ts index 4064fb9e02..2f3d7db69d 100644 --- a/packages/frontend/src/app/guards/auth.guard.ts +++ b/packages/frontend/src/app/guards/auth.guard.ts @@ -1,7 +1,6 @@ import { Injectable } from "@angular/core"; import { ActivatedRouteSnapshot, - CanActivate, Router, RouterStateSnapshot, } from "@angular/router"; @@ -12,7 +11,7 @@ import { catchError, map } from "rxjs/operators"; import { AuthService } from "../modules/shared/services/auth.service"; @Injectable({ providedIn: "root" }) -export class AuthGuard implements CanActivate { +export class AuthGuard { constructor( public router: Router, private readonly authService: AuthService diff --git a/packages/frontend/src/app/guards/can-edit-portail-usager.guard.ts b/packages/frontend/src/app/guards/can-edit-portail-usager.guard.ts index e2fe5daf23..3acf646f90 100644 --- a/packages/frontend/src/app/guards/can-edit-portail-usager.guard.ts +++ b/packages/frontend/src/app/guards/can-edit-portail-usager.guard.ts @@ -1,11 +1,11 @@ import { Injectable } from "@angular/core"; -import { CanActivate, Router } from "@angular/router"; +import { Router } from "@angular/router"; import { CustomToastService } from "../modules/shared/services/custom-toast.service"; import { Observable } from "rxjs"; import { AuthService } from "../modules/shared/services/auth.service"; @Injectable({ providedIn: "root" }) -export class CanEditPortailUsagerGuard implements CanActivate { +export class CanEditPortailUsagerGuard { constructor( private readonly router: Router, private readonly authService: AuthService, diff --git a/packages/frontend/src/app/guards/can-edit-sms.guard.ts b/packages/frontend/src/app/guards/can-edit-sms.guard.ts index edfd69ad5b..66e12e481f 100644 --- a/packages/frontend/src/app/guards/can-edit-sms.guard.ts +++ b/packages/frontend/src/app/guards/can-edit-sms.guard.ts @@ -1,11 +1,11 @@ import { Injectable } from "@angular/core"; -import { CanActivate, Router } from "@angular/router"; +import { Router } from "@angular/router"; import { Observable } from "rxjs"; import { AuthService } from "../modules/shared/services/auth.service"; import { CustomToastService } from "../modules/shared/services/custom-toast.service"; @Injectable({ providedIn: "root" }) -export class CanEditSmsGuard implements CanActivate { +export class CanEditSmsGuard { constructor( private readonly router: Router, private readonly authService: AuthService, diff --git a/packages/frontend/src/app/guards/facteur.guard.ts b/packages/frontend/src/app/guards/facteur.guard.ts index 16f3351429..2590987643 100644 --- a/packages/frontend/src/app/guards/facteur.guard.ts +++ b/packages/frontend/src/app/guards/facteur.guard.ts @@ -1,5 +1,5 @@ import { Injectable } from "@angular/core"; -import { CanActivate, Router } from "@angular/router"; +import { Router } from "@angular/router"; import { Observable } from "rxjs"; @@ -7,7 +7,7 @@ import { AuthService } from "../modules/shared/services/auth.service"; import { CustomToastService } from "../modules/shared/services/custom-toast.service"; @Injectable({ providedIn: "root" }) -export class FacteurGuard implements CanActivate { +export class FacteurGuard { constructor( private readonly router: Router, private readonly authService: AuthService, diff --git a/packages/frontend/src/app/guards/logged.guard.ts b/packages/frontend/src/app/guards/logged.guard.ts index f76c53739d..18c1573f29 100644 --- a/packages/frontend/src/app/guards/logged.guard.ts +++ b/packages/frontend/src/app/guards/logged.guard.ts @@ -1,5 +1,5 @@ import { Injectable } from "@angular/core"; -import { CanActivate, Router } from "@angular/router"; +import { Router } from "@angular/router"; import { CustomToastService } from "../modules/shared/services/custom-toast.service"; import { Observable, of } from "rxjs"; @@ -8,7 +8,7 @@ import { map } from "rxjs/operators"; import { AuthService } from "../modules/shared/services/auth.service"; @Injectable({ providedIn: "root" }) -export class LoggedGuard implements CanActivate { +export class LoggedGuard { constructor( private readonly router: Router, private readonly authService: AuthService, diff --git a/packages/frontend/src/app/guards/responsable.guard.ts b/packages/frontend/src/app/guards/responsable.guard.ts index 651fe3f1e4..3376586028 100644 --- a/packages/frontend/src/app/guards/responsable.guard.ts +++ b/packages/frontend/src/app/guards/responsable.guard.ts @@ -1,5 +1,5 @@ import { Injectable } from "@angular/core"; -import { CanActivate, Router } from "@angular/router"; +import { Router } from "@angular/router"; import { Observable } from "rxjs"; @@ -7,7 +7,7 @@ import { AuthService } from "../modules/shared/services/auth.service"; import { CustomToastService } from "../modules/shared/services/custom-toast.service"; @Injectable({ providedIn: "root" }) -export class ResponsableGuard implements CanActivate { +export class ResponsableGuard { constructor( private readonly router: Router, private readonly authService: AuthService, diff --git a/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.html b/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.html index 9aa395267f..123b9fc4c1 100644 --- a/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.html +++ b/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.html @@ -257,6 +257,24 @@

Cookies

> +
+

+ +

diff --git a/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.spec.ts b/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.spec.ts index 5d151158b3..47841db9d2 100644 --- a/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.spec.ts +++ b/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.spec.ts @@ -1,16 +1,20 @@ -import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; - +import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core"; +import { MATOMO_INJECTORS } from "../../../../../shared"; import { PolitiqueComponent } from "./politique.component"; +import { ComponentFixture, TestBed } from "@angular/core/testing"; +import { FormsModule } from "@angular/forms"; describe("PolitiqueComponent", () => { let component: PolitiqueComponent; let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ + beforeEach(async () => { + await TestBed.configureTestingModule({ declarations: [PolitiqueComponent], + imports: [...MATOMO_INJECTORS, FormsModule], + schemas: [CUSTOM_ELEMENTS_SCHEMA], }).compileComponents(); - })); + }); beforeEach(() => { fixture = TestBed.createComponent(PolitiqueComponent); diff --git a/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.ts b/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.ts index 539223ee28..e17efe7fff 100644 --- a/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.ts +++ b/packages/frontend/src/app/modules/general/components/static-pages/politique/politique.component.ts @@ -1,14 +1,31 @@ -import { Component, OnInit } from "@angular/core"; +import { Component } from "@angular/core"; import { Title } from "@angular/platform-browser"; +import { MatomoTracker } from "ngx-matomo-client"; @Component({ selector: "app-politique", templateUrl: "./politique.component.html", }) -export class PolitiqueComponent implements OnInit { - public constructor(private readonly titleService: Title) {} +export class PolitiqueComponent { + public optedOut$: Promise; - public ngOnInit(): void { + public constructor( + private readonly titleService: Title, + private readonly tracker: MatomoTracker + ) { + this.optedOut$ = tracker.isUserOptedOut(); this.titleService.setTitle("Politique de confidentialité de DomiFa"); } + + handleChange(optOut: boolean) { + if (optOut) { + this.tracker.optUserOut(); + localStorage.setItem("matomo-opted-in", JSON.stringify(false)); + } else { + localStorage.setItem("matomo-opted-in", JSON.stringify(true)); + this.tracker.forgetUserOptOut(); + } + + this.optedOut$ = this.tracker.isUserOptedOut(); + } } diff --git a/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.ts b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.ts index 907b6fc7d4..ac764dbb77 100644 --- a/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.ts +++ b/packages/frontend/src/app/modules/usager-profil/components/_historiques/profil-historique-login-portail/profil-historique-login-portail.component.ts @@ -61,7 +61,6 @@ export class ProfilHistoriqueLoginPortailComponent this.interactionService .getLoginPortail(this.usager.ref, this.params) .subscribe((searchResults: PageResults) => { - console.log(searchResults); this.loading = false; this.interactions = searchResults.data; this.searchResults = searchResults; diff --git a/packages/frontend/src/app/modules/usager-profil/services/usager-options.service.ts b/packages/frontend/src/app/modules/usager-profil/services/usager-options.service.ts index 1e0a0c672a..bf6efaf29a 100644 --- a/packages/frontend/src/app/modules/usager-profil/services/usager-options.service.ts +++ b/packages/frontend/src/app/modules/usager-profil/services/usager-options.service.ts @@ -68,7 +68,6 @@ export class UsagerOptionsService { ) .pipe( tap((newUsager: UsagerLight) => { - console.log(newUsager); this.store.dispatch(cacheManager.updateUsager({ usager: newUsager })); }) ); diff --git a/packages/portail-usagers/src/_common/mocks/DEFAULT_USAGER.const.ts b/packages/portail-usagers/src/_common/mocks/DEFAULT_USAGER.const.ts index 721aa9a8c6..38f2e1173d 100644 --- a/packages/portail-usagers/src/_common/mocks/DEFAULT_USAGER.const.ts +++ b/packages/portail-usagers/src/_common/mocks/DEFAULT_USAGER.const.ts @@ -65,4 +65,5 @@ export const DEFAULT_USAGER: PortailUsagerPublic = { export const DEFAULT_USAGER_PROFILE: PortailUsagerProfile = { usager: DEFAULT_USAGER, + acceptTerms: new Date(), }; diff --git a/packages/portail-usagers/src/app/app.component.ts b/packages/portail-usagers/src/app/app.component.ts index fc88583caf..229348c5c4 100644 --- a/packages/portail-usagers/src/app/app.component.ts +++ b/packages/portail-usagers/src/app/app.component.ts @@ -5,6 +5,8 @@ import { NavigationEnd, Router } from "@angular/router"; import { filter } from "rxjs"; import { LIENS_PARTENAIRES } from "./modules/general/components/_static/plan-site/LIENS_PARTENAIRES.const"; import { PortailUsagerProfile } from "@domifa/common"; +import { globalConstants } from "./shared"; +import { MatomoTracker } from "ngx-matomo-client"; @Component({ selector: "app-root", @@ -22,6 +24,7 @@ export class AppComponent implements OnInit { private readonly titleService: Title, private readonly router: Router, private readonly usagerAuthService: UsagerAuthService, + private readonly matomo: MatomoTracker, ) { this.apiVersion = null; this.usagerProfile = null; @@ -35,13 +38,26 @@ export class AppComponent implements OnInit { public matomoInfo: boolean; public initMatomo(): void { - const matomo = localStorage.getItem("matomo"); + const matomo = globalConstants.getItem("matomo"); this.matomoInfo = matomo === "done"; + + if (globalConstants.getItem("matomo-opted-in") === null) { + globalConstants.setItem("matomo-opted-in", JSON.stringify(true)); + } + + const disableMatomo = + JSON.parse(globalConstants.getItem("matomo-opted-in")) === true; + + if (!disableMatomo) { + this.matomo.optUserOut(); + } else { + globalConstants.setItem("matomo-opted-in", JSON.stringify(true)); + } } public closeMatomo(): void { this.matomoInfo = true; - localStorage.setItem("matomo", "done"); + globalConstants.setItem("matomo", "done"); } public ngOnInit(): void { diff --git a/packages/portail-usagers/src/app/app.module.ts b/packages/portail-usagers/src/app/app.module.ts index 49393d6ca7..568c0177a0 100644 --- a/packages/portail-usagers/src/app/app.module.ts +++ b/packages/portail-usagers/src/app/app.module.ts @@ -25,7 +25,7 @@ import { SharedModule } from "./modules/shared/shared.module"; import { CustomToastService } from "./modules/shared/services/custom-toast.service"; import { GeneralModule } from "./modules/general/general.module"; import { MATOMO_INJECTORS } from "./shared"; -import { UserIdleModule } from "angular-user-idle"; +import { provideUserIdleConfig } from "angular-user-idle"; import { registerLocaleData } from "@angular/common"; import localeFr from "@angular/common/locales/fr"; @@ -46,8 +46,7 @@ registerLocaleData(localeFr, "fr"); NgbModule, SharedModule, ReactiveFormsModule, - ...MATOMO_INJECTORS, - UserIdleModule.forRoot({ idle: 3600, timeout: 60, ping: 20 }), + MATOMO_INJECTORS, ], providers: [ UsagerAuthService, @@ -55,6 +54,7 @@ registerLocaleData(localeFr, "fr"); { provide: LOCALE_ID, useValue: "fr" }, { provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true }, { provide: ErrorHandler, useClass: SentryErrorHandler }, + provideUserIdleConfig({ idle: 3600, timeout: 60, ping: 20 }), ], schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], }) diff --git a/packages/portail-usagers/src/app/guards/auth-guard.ts b/packages/portail-usagers/src/app/guards/auth-guard.ts index 83f5941040..17d1aea5a5 100644 --- a/packages/portail-usagers/src/app/guards/auth-guard.ts +++ b/packages/portail-usagers/src/app/guards/auth-guard.ts @@ -1,7 +1,6 @@ import { Injectable } from "@angular/core"; import { ActivatedRouteSnapshot, - CanActivate, Router, RouterStateSnapshot, } from "@angular/router"; @@ -11,7 +10,7 @@ import { catchError, map } from "rxjs/operators"; import { UsagerAuthService } from "../modules/usager-auth/services/usager-auth.service"; @Injectable({ providedIn: "root" }) -export class AuthGuard implements CanActivate { +export class AuthGuard { constructor( private readonly router: Router, private readonly authService: UsagerAuthService, diff --git a/packages/portail-usagers/src/app/modules/general/components/_static/cgu/cgu.component.ts b/packages/portail-usagers/src/app/modules/general/components/_static/cgu/cgu.component.ts index 062f40c219..5925b90eca 100644 --- a/packages/portail-usagers/src/app/modules/general/components/_static/cgu/cgu.component.ts +++ b/packages/portail-usagers/src/app/modules/general/components/_static/cgu/cgu.component.ts @@ -1,13 +1,12 @@ -import { Component, OnInit } from "@angular/core"; +import { Component } from "@angular/core"; import { Title } from "@angular/platform-browser"; @Component({ selector: "app-cgu", templateUrl: "./cgu.component.html", }) -export class CguComponent implements OnInit { - constructor(private readonly titleService: Title) {} - public ngOnInit(): void { +export class CguComponent { + constructor(private readonly titleService: Title) { this.titleService.setTitle("Conditions générales d'utilisation"); } } diff --git a/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.html b/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.html index 55ade89f2d..c3eeac5ce3 100644 --- a/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.html +++ b/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.html @@ -238,6 +238,24 @@

Cookies

> +
+

+ +

diff --git a/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.spec.ts b/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.spec.ts index 5d151158b3..ccf7ea3c1a 100644 --- a/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.spec.ts +++ b/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.spec.ts @@ -1,6 +1,8 @@ import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; import { PolitiqueComponent } from "./politique.component"; +import { ReactiveFormsModule, FormsModule } from "@angular/forms"; +import { MATOMO_INJECTORS } from "../../../../../shared"; describe("PolitiqueComponent", () => { let component: PolitiqueComponent; @@ -9,6 +11,7 @@ describe("PolitiqueComponent", () => { beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ declarations: [PolitiqueComponent], + imports: [ReactiveFormsModule, MATOMO_INJECTORS, FormsModule], }).compileComponents(); })); diff --git a/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.ts b/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.ts index 616156a3dc..9c334c2c41 100644 --- a/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.ts +++ b/packages/portail-usagers/src/app/modules/general/components/_static/politique/politique.component.ts @@ -1,14 +1,32 @@ -import { Component, OnInit } from "@angular/core"; +import { Component } from "@angular/core"; import { Title } from "@angular/platform-browser"; +import { MatomoTracker } from "ngx-matomo-client"; +import { globalConstants } from "../../../../../shared"; @Component({ selector: "app-politique", templateUrl: "./politique.component.html", }) -export class PolitiqueComponent implements OnInit { - public constructor(private readonly titleService: Title) {} +export class PolitiqueComponent { + optedOut$: Promise; - public ngOnInit(): void { + public constructor( + private readonly titleService: Title, + private readonly tracker: MatomoTracker, + ) { + this.optedOut$ = tracker.isUserOptedOut(); this.titleService.setTitle("Politique de confidentialité de Mon DomiFa"); } + + handleChange(optOut: any) { + if (optOut) { + this.tracker.optUserOut(); + globalConstants.setItem("matomo-opted-in", false); + } else { + globalConstants.setItem("matomo-opted-in", true); + this.tracker.forgetUserOptOut(); + } + + this.optedOut$ = this.tracker.isUserOptedOut(); + } } diff --git a/packages/portail-usagers/src/app/modules/general/general.module.ts b/packages/portail-usagers/src/app/modules/general/general.module.ts index f448e76279..a425c66274 100644 --- a/packages/portail-usagers/src/app/modules/general/general.module.ts +++ b/packages/portail-usagers/src/app/modules/general/general.module.ts @@ -19,6 +19,7 @@ import { CguComponent } from "./components/_static/cgu/cgu.component"; import { RgaaComponent } from "./components/_static/rgaa/rgaa.component"; import { IdleManagerComponent } from "./components/idle-manager/idle-manager.component"; import { PlanSiteComponent } from "./components/_static/plan-site/plan-site.component"; +import { FormsModule } from "@angular/forms"; @NgModule({ declarations: [ @@ -44,6 +45,7 @@ import { PlanSiteComponent } from "./components/_static/plan-site/plan-site.comp RouterModule.forChild([]), SharedModule, NgbModule, + FormsModule, ], schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], diff --git a/packages/portail-usagers/src/app/modules/usager-account/components/home-usager/home-usager.component.html b/packages/portail-usagers/src/app/modules/usager-account/components/home-usager/home-usager.component.html index 2e5d636133..681ba0a748 100644 --- a/packages/portail-usagers/src/app/modules/usager-account/components/home-usager/home-usager.component.html +++ b/packages/portail-usagers/src/app/modules/usager-account/components/home-usager/home-usager.component.html @@ -3,7 +3,7 @@

Bonjour {{ usagerProfile.usager.prenom }} {{ usagerProfile.usager.nom }} - - {{ usagerProfile.usager.customRef || usagerProfile.usager.customRef }} ! + {{ usagerProfile.usager.customRef }} !

Bienvenue dans votre espace de suivi de courrier { + if (!apiResponse?.acceptTerms) { + this.router.navigate(["/account/accept-terms"]); + return; + } this.usagerProfile = apiResponse; }, ); diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.css b/packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.css similarity index 100% rename from packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.css rename to packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.css diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.html b/packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.html similarity index 98% rename from packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.html rename to packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.html index 783176040b..7ad1d9864c 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.html +++ b/packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.html @@ -1,7 +1,6 @@ -
+

Veuillez lire et accepter les CGU

-

Les conditions générales d'utilisation de DomiFa évoluent.
Afin de pouvoir continuer à l'utiliser, merci de lire et accepter les nouvelles diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.spec.ts b/packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.spec.ts similarity index 85% rename from packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.spec.ts rename to packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.spec.ts index 0fa54d4aa1..edca3bcc5d 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.spec.ts +++ b/packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from "@angular/core/testing"; import { UsagerAcceptCguComponent } from "./usager-accept-cgu.component"; +import { HttpClientTestingModule } from "@angular/common/http/testing"; describe("UsagerAcceptCguComponent", () => { let component: UsagerAcceptCguComponent; @@ -9,6 +10,7 @@ describe("UsagerAcceptCguComponent", () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [UsagerAcceptCguComponent], + imports: [HttpClientTestingModule], }).compileComponents(); fixture = TestBed.createComponent(UsagerAcceptCguComponent); diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.ts b/packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.ts similarity index 85% rename from packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.ts rename to packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.ts index 75574b1834..21eec5af8a 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-accept-cgu/usager-accept-cgu.component.ts +++ b/packages/portail-usagers/src/app/modules/usager-account/components/usager-accept-cgu/usager-accept-cgu.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from "@angular/core"; +import { Component } from "@angular/core"; import { AbstractControl, FormBuilder, @@ -6,8 +6,8 @@ import { Validators, } from "@angular/forms"; import { Subscription } from "rxjs"; -import { CustomToastService } from "../../shared/services/custom-toast.service"; -import { UsagerAuthService } from "../services/usager-auth.service"; +import { CustomToastService } from "../../../shared/services/custom-toast.service"; +import { UsagerAuthService } from "../../../usager-auth/services/usager-auth.service"; import { PortailUsagerProfile } from "@domifa/common"; import { Router } from "@angular/router"; @@ -16,7 +16,7 @@ import { Router } from "@angular/router"; templateUrl: "./usager-accept-cgu.component.html", styleUrls: ["./usager-accept-cgu.component.css"], }) -export class UsagerAcceptCguComponent implements OnInit { +export class UsagerAcceptCguComponent { public acceptTermsForm!: FormGroup; public loading: boolean; @@ -36,11 +36,11 @@ export class UsagerAcceptCguComponent implements OnInit { this.usagerAuthService.currentUsagerSubject.subscribe( (apiResponse: PortailUsagerProfile | null) => { this.usagerProfile = apiResponse; + if (apiResponse?.acceptTerms) { + this.router.navigate(["/account"]); + } }, ); - } - - ngOnInit(): void { this.initCguForm(); } diff --git a/packages/portail-usagers/src/app/modules/usager-account/usager-account-routing.module.ts b/packages/portail-usagers/src/app/modules/usager-account/usager-account-routing.module.ts index 80c8854849..5b442b9e17 100644 --- a/packages/portail-usagers/src/app/modules/usager-account/usager-account-routing.module.ts +++ b/packages/portail-usagers/src/app/modules/usager-account/usager-account-routing.module.ts @@ -1,8 +1,15 @@ import { NgModule } from "@angular/core"; import { RouterModule, Routes } from "@angular/router"; import { HomeUsagerComponent } from "./components/home-usager/home-usager.component"; +import { UsagerAcceptCguComponent } from "./components/usager-accept-cgu/usager-accept-cgu.component"; -const routes: Routes = [{ path: "", component: HomeUsagerComponent }]; +const routes: Routes = [ + { path: "", component: HomeUsagerComponent }, + { + path: "accept-terms", + component: UsagerAcceptCguComponent, + }, +]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/packages/portail-usagers/src/app/modules/usager-account/usager-account.module.ts b/packages/portail-usagers/src/app/modules/usager-account/usager-account.module.ts index 1e47ad186d..c871df440e 100644 --- a/packages/portail-usagers/src/app/modules/usager-account/usager-account.module.ts +++ b/packages/portail-usagers/src/app/modules/usager-account/usager-account.module.ts @@ -8,6 +8,9 @@ import { SectionCourriersComponent } from "./components/section-courriers/sectio import { SectionInfosComponent } from "./components/section-infos/section-infos.component"; import { SectionOptionsComponent } from "./components/section-options/section-options.component"; import { SharedModule } from "../shared/shared.module"; +import { UsagerAcceptCguComponent } from "./components/usager-accept-cgu/usager-accept-cgu.component"; +import { GeneralModule } from "../general/general.module"; +import { FormsModule, ReactiveFormsModule } from "@angular/forms"; @NgModule({ declarations: [ @@ -15,11 +18,15 @@ import { SharedModule } from "../shared/shared.module"; SectionInfosComponent, SectionCourriersComponent, SectionOptionsComponent, + UsagerAcceptCguComponent, ], imports: [ CommonModule, UsagerAccountRoutingModule, SharedModule, + GeneralModule, + FormsModule, + ReactiveFormsModule, FontAwesomeModule, ], schemas: [CUSTOM_ELEMENTS_SCHEMA], diff --git a/packages/portail-usagers/src/app/modules/usager-auth/services/usager-auth.service.ts b/packages/portail-usagers/src/app/modules/usager-auth/services/usager-auth.service.ts index 8357d38fa4..2e035c56b2 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/services/usager-auth.service.ts +++ b/packages/portail-usagers/src/app/modules/usager-auth/services/usager-auth.service.ts @@ -17,7 +17,7 @@ const END_POINT_AUTH = environment.apiUrl + "portail-usagers/auth"; const END_POINT_PROFILE = environment.apiUrl + "portail-usagers/profile"; const TOKEN_KEY = "usager-auth-token"; -const USER_KEY = "usager-auth-datas"; +const USER_KEY = "usager-auth-data"; @Injectable({ providedIn: "root", diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-auth-routing.module.ts b/packages/portail-usagers/src/app/modules/usager-auth/usager-auth-routing.module.ts index 0ddeb17c92..788d6fcb3e 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-auth-routing.module.ts +++ b/packages/portail-usagers/src/app/modules/usager-auth/usager-auth-routing.module.ts @@ -1,12 +1,8 @@ import { NgModule } from "@angular/core"; import { RouterModule, Routes } from "@angular/router"; import { UsagerLoginComponent } from "./usager-login/usager-login.component"; -import { UsagerAcceptCguComponent } from "./usager-accept-cgu/usager-accept-cgu.component"; -const routes: Routes = [ - { path: "login", component: UsagerLoginComponent }, - { path: "accept-terms", component: UsagerAcceptCguComponent }, -]; +const routes: Routes = [{ path: "login", component: UsagerLoginComponent }]; @NgModule({ imports: [RouterModule.forChild(routes)], diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-auth.module.ts b/packages/portail-usagers/src/app/modules/usager-auth/usager-auth.module.ts index 0a2d9689b5..afca637a46 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-auth.module.ts +++ b/packages/portail-usagers/src/app/modules/usager-auth/usager-auth.module.ts @@ -9,11 +9,9 @@ import { UsagerAuthService } from "./services/usager-auth.service"; import { UsagerAuthRoutingModule } from "./usager-auth-routing.module"; import { UsagerLoginComponent } from "./usager-login/usager-login.component"; -import { UsagerAcceptCguComponent } from "./usager-accept-cgu/usager-accept-cgu.component"; -import { GeneralModule } from "../general/general.module"; @NgModule({ - declarations: [UsagerLoginComponent, UsagerAcceptCguComponent], + declarations: [UsagerLoginComponent], imports: [ CommonModule, UsagerAuthRoutingModule, @@ -22,7 +20,6 @@ import { GeneralModule } from "../general/general.module"; FontAwesomeModule, SharedModule, ReactiveFormsModule, - GeneralModule, ], providers: [UsagerAuthService], }) diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.html b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.html index 85f5ecf801..f863296d33 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.html +++ b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.html @@ -269,7 +269,7 @@

Connexion à Mon DomiFa

name="acceptTerms" class="form-check-input me-2" [ngClass]="{ - 'is-invalid': f.acceptTerms?.errors + 'is-invalid': f.acceptTerms.errors }" [attr.aria-describedby]=" f.acceptTerms.errors ? 'invalid-cgu-choice' : null diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.spec.ts b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.spec.ts index addd2998da..245076ed14 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.spec.ts +++ b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.spec.ts @@ -18,7 +18,7 @@ describe("UsagerLoginComponent", () => { imports: [ HttpClientTestingModule, ReactiveFormsModule, - ...MATOMO_INJECTORS, + MATOMO_INJECTORS, NgbModule, FormsModule, RouterTestingModule, diff --git a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts index a0776a911d..4e4c284121 100644 --- a/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts +++ b/packages/portail-usagers/src/app/modules/usager-auth/usager-login/usager-login.component.ts @@ -98,7 +98,7 @@ export class UsagerLoginComponent implements OnInit, OnDestroy { { value: "", disabled: true }, Validators.compose([Validators.required, Validators.minLength(8)]), ], - acceptTerms: [{ value: "", disabled: true }, [Validators.required]], + acceptTerms: [{ value: false, disabled: true }, [Validators.required]], }, { validators: [ @@ -153,13 +153,7 @@ export class UsagerLoginComponent implements OnInit, OnDestroy { this.toastr.success("Connexion réussie !"); this.authService.saveToken(apiAuthResponse); - if (!apiAuthResponse.acceptTerms) { - this.router.navigate(["/auth/accept-terms"]); - return; - } - this.loading = false; - this.router.navigate(["/account"]); this.matomo.trackEvent( "login-portail-usagers", @@ -167,6 +161,12 @@ export class UsagerLoginComponent implements OnInit, OnDestroy { "null", 1, ); + if (!apiAuthResponse.acceptTerms) { + this.router.navigate(["/account/accept-terms"]); + return; + } + + this.router.navigate(["/account"]); }, error: (err) => { diff --git a/packages/portail-usagers/src/app/shared/global-constants.class.ts b/packages/portail-usagers/src/app/shared/global-constants.class.ts index 492c739b49..50fd55bb77 100644 --- a/packages/portail-usagers/src/app/shared/global-constants.class.ts +++ b/packages/portail-usagers/src/app/shared/global-constants.class.ts @@ -8,21 +8,12 @@ export class GlobalConstants { if (typeof localStorage !== "undefined" && localStorage !== null) { this.storageName = "localStorage"; this.storage = localStorage; - if (!localStorage.getItem("DATA_CLEAN")) { - localStorage.clear(); - localStorage.setItem("DATA_CLEAN", "true"); - } } else if ( typeof sessionStorage !== "undefined" && sessionStorage !== null ) { this.storageName = "sessionStorage"; this.storage = sessionStorage; - - if (!sessionStorage.getItem("DATA_CLEAN")) { - sessionStorage.clear(); - sessionStorage.setItem("DATA_CLEAN", "true"); - } } else { this.storageName = "globalVariable"; this.storage = null;