Skip to content

Commit

Permalink
fix(cgu): add privacy policy
Browse files Browse the repository at this point in the history
  • Loading branch information
pYassine committed Nov 28, 2023
1 parent 977f243 commit 6c956fd
Show file tree
Hide file tree
Showing 45 changed files with 225 additions and 104 deletions.
8 changes: 5 additions & 3 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Binary file modified _scripts/db/dumps/domifa_test.postgres.custom.gz
Binary file not shown.
10 changes: 5 additions & 5 deletions _scripts/db/dumps/domifa_test.postgres.restore-data-only.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
\.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
\.
Expand Down
13 changes: 10 additions & 3 deletions packages/backend/src/_migrations/1700663362619-auto-migration.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
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<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions packages/frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 2 additions & 3 deletions packages/frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) ||
Expand Down Expand Up @@ -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 },
{
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/app/guards/admin.guard.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/src/app/guards/auth.guard.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Injectable } from "@angular/core";
import {
ActivatedRouteSnapshot,
CanActivate,
Router,
RouterStateSnapshot,
} from "@angular/router";
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/app/guards/can-edit-sms.guard.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/app/guards/facteur.guard.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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 FacteurGuard implements CanActivate {
export class FacteurGuard {
constructor(
private readonly router: Router,
private readonly authService: AuthService,
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/app/guards/logged.guard.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/src/app/guards/responsable.guard.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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 ResponsableGuard implements CanActivate {
export class ResponsableGuard {
constructor(
private readonly router: Router,
private readonly authService: AuthService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,24 @@ <h2>Cookies</h2>
>
</li>
</ul>
<br />
<p>
<label>
<input
type="checkbox"
[ngModel]="optedOut$ | async"
(ngModelChange)="handleChange($event)"
/>
<ng-container *ngIf="optedOut$ | async; else optedIn">
Vous n'êtes plus suivis de manière anonyme. Décochez cette case pour
activer le suivi anonyme.
</ng-container>
<ng-template #optedIn>
Vous êtes suivis de manière anonyme. Cochez cette case pour ne plus
être suivi.</ng-template
>
</label>
</p>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -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<PolitiqueComponent>;

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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<boolean>;

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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ export class ProfilHistoriqueLoginPortailComponent
this.interactionService
.getLoginPortail(this.usager.ref, this.params)
.subscribe((searchResults: PageResults<UserUsagerLogin>) => {
console.log(searchResults);
this.loading = false;
this.interactions = searchResults.data;
this.searchResults = searchResults;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class UsagerOptionsService {
)
.pipe(
tap((newUsager: UsagerLight) => {
console.log(newUsager);
this.store.dispatch(cacheManager.updateUsager({ usager: newUsager }));
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ export const DEFAULT_USAGER: PortailUsagerPublic = {

export const DEFAULT_USAGER_PROFILE: PortailUsagerProfile = {
usager: DEFAULT_USAGER,
acceptTerms: new Date(),
};
Loading

0 comments on commit 6c956fd

Please sign in to comment.