From f7b9053f3755ab0d27b09b897353d52d003e3fad Mon Sep 17 00:00:00 2001 From: Etienne LOUPIAS <eloupias@grandlyon.com> Date: Thu, 23 Nov 2023 16:43:51 +0100 Subject: [PATCH 1/4] fix(user): case insensitive email (lowercase) --- src/app/profile/services/profile.service.ts | 7 +++++-- .../structure-add-member-modal.component.ts | 2 +- src/app/services/auth.service.ts | 6 +++--- src/app/services/newsletter.service.ts | 6 +++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/app/profile/services/profile.service.ts b/src/app/profile/services/profile.service.ts index 9ef856481..da35a4a9c 100644 --- a/src/app/profile/services/profile.service.ts +++ b/src/app/profile/services/profile.service.ts @@ -75,11 +75,14 @@ export class ProfileService { }); } public changeEmail(newEmail: string, oldEmail: string): Observable<User> { - return this.http.post<any>(`${this.baseUrl}/change-email`, { newEmail, oldEmail }); + return this.http.post<any>(`${this.baseUrl}/change-email`, { + newEmail: newEmail.toLowerCase(), + oldEmail: oldEmail.toLowerCase(), + }); } public isEmailAlreadyUsed(newMail: string): Observable<boolean> { - return this.http.post<boolean>(`${this.baseUrl}/verify-exist-user`, { newMail }); + return this.http.post<boolean>(`${this.baseUrl}/verify-exist-user`, { newMail: newMail.toLowerCase() }); } public getAllDataConsentPendingStructures(): Observable<Structure[]> { diff --git a/src/app/profile/structure-add-member-modal/structure-add-member-modal.component.ts b/src/app/profile/structure-add-member-modal/structure-add-member-modal.component.ts index 1992f4fc3..96b184a49 100644 --- a/src/app/profile/structure-add-member-modal/structure-add-member-modal.component.ts +++ b/src/app/profile/structure-add-member-modal/structure-add-member-modal.component.ts @@ -47,7 +47,7 @@ export class StructureAddMemberModalComponent implements OnInit { return; } const user = new TempUser(); - user.email = this.fAddAccount.email.value; + user.email = this.fAddAccount.email.value.toLowerCase(); this.structureService.addOwnerToStructure(user, this.structure.structure._id).subscribe( (res) => { if ((res as TempUser).email) { diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 093bfe6da..bdcd462fb 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -68,7 +68,7 @@ export class AuthService { } public login(email: string, password: string): Observable<any> { - return this.http.post<UserAuth>('api/auth/login', { email, password }).pipe( + return this.http.post<UserAuth>('api/auth/login', { email: email.toLowerCase(), password }).pipe( map((user) => { // store user details and jwt token in local storage to keep user logged in between page refreshes localStorage.setItem('user', JSON.stringify(user)); @@ -79,7 +79,7 @@ export class AuthService { } public resendEmail(email: string, password: string): Observable<User> { - return this.http.post<User>(`api/auth/resendEmail`, { email, password }); + return this.http.post<User>(`api/auth/resendEmail`, { email: email.toLowerCase(), password }); } public verifyUser(userId: string, token: string): Observable<User> { @@ -89,7 +89,7 @@ export class AuthService { } public resetPassword(email: string): Observable<any> { - return this.http.post(`api/users/reset-password`, { email }); + return this.http.post(`api/users/reset-password`, { email: email.toLowerCase() }); } public resetPasswordApply(token: string, password: string): Observable<any> { diff --git a/src/app/services/newsletter.service.ts b/src/app/services/newsletter.service.ts index 4635c10d8..0f2c17569 100644 --- a/src/app/services/newsletter.service.ts +++ b/src/app/services/newsletter.service.ts @@ -10,14 +10,14 @@ export class NewsletterService { constructor(private http: HttpClient) {} public subscribe(email: string): Observable<NewsletterSubscription> { - return this.http.post<NewsletterSubscription>('/api/newsletter/subscribe', { email }); + return this.http.post<NewsletterSubscription>('/api/newsletter/subscribe', { email: email.toLowerCase() }); } public unsubscribe(email: string): Observable<NewsletterSubscription> { - return this.http.post<NewsletterSubscription>('/api/newsletter/unsubscribe', { email }); + return this.http.post<NewsletterSubscription>('/api/newsletter/unsubscribe', { email: email.toLowerCase() }); } public find(email: string): Observable<NewsletterSubscription> { - return this.http.get<NewsletterSubscription>(`/api/newsletter?email=${email}`); + return this.http.get<NewsletterSubscription>(`/api/newsletter?email=${email.toLowerCase()}`); } } -- GitLab From 29ea75f1436084ad4edf86809c2989f39419d048 Mon Sep 17 00:00:00 2001 From: Etienne LOUPIAS <eloupias@grandlyon.com> Date: Fri, 24 Nov 2023 15:55:25 +0100 Subject: [PATCH 2/4] fix(employer): display error when creating employer from profile --- .../manage-employers/manage-employers.component.html | 4 ++-- src/app/profile/edit/edit.component.ts | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/app/admin/components/manage-employers/manage-employers.component.html b/src/app/admin/components/manage-employers/manage-employers.component.html index acdcc7b10..823f405ba 100644 --- a/src/app/admin/components/manage-employers/manage-employers.component.html +++ b/src/app/admin/components/manage-employers/manage-employers.component.html @@ -9,7 +9,7 @@ </div> <div class="adminLayout"> - <h3 *ngIf="unvalidatedEmployers" class="title">Employeurs non validées ({{ unvalidatedEmployers.length }})</h3> + <h3 *ngIf="unvalidatedEmployers" class="title">Employeurs non validés ({{ unvalidatedEmployers.length }})</h3> <ag-grid-angular *ngIf="unvalidatedEmployers" class="ag-theme-alpine user-table" @@ -24,7 +24,7 @@ > </ag-grid-angular> - <h3 *ngIf="validatedEmployers" class="title">Employeurs validées ({{ validatedEmployers.length }})</h3> + <h3 *ngIf="validatedEmployers" class="title">Employeurs validés ({{ validatedEmployers.length }})</h3> <ag-grid-angular *ngIf="validatedEmployers" class="ag-theme-alpine user-table" diff --git a/src/app/profile/edit/edit.component.ts b/src/app/profile/edit/edit.component.ts index 7a15626dd..759539d9c 100644 --- a/src/app/profile/edit/edit.component.ts +++ b/src/app/profile/edit/edit.component.ts @@ -2,6 +2,7 @@ import { HttpErrorResponse } from '@angular/common/http'; import { ChangeDetectorRef, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; import * as _ from 'lodash'; +import { lastValueFrom } from 'rxjs'; import { catchError, first } from 'rxjs/operators'; import { Employer } from '../../models/employer.model'; import { Job } from '../../models/job.model'; @@ -231,17 +232,14 @@ export class EditComponent implements OnInit { }); } - public confirmEmployer(): void { + public async confirmEmployer(): Promise<void> { if (this.newJob) { this.selectedJob = this.newJob; - this.profileService.createJob(this.selectedJob).subscribe((res) => { - console.log(res); - }); + + const resJob = await lastValueFrom(this.profileService.createJob(this.selectedJob)); } if (this.isNewEmployer) { - this.profileService.createEmployer(this.selectedEmployer).subscribe((res) => { - console.log(res); - }); + const resEmployer = await lastValueFrom(this.profileService.createEmployer(this.selectedEmployer)); } this.profileService -- GitLab From 558ba3d547198d4778f569bd35cd20d66090cd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20PAILHAREY?= <rpailharey@grandlyon.com> Date: Mon, 27 Nov 2023 14:18:52 +0000 Subject: [PATCH 3/4] fix: print for orientation recap and structure list --- src/app/app-routing.module.ts | 16 ++---- src/app/app.component.html | 2 +- src/app/shared/components/index.ts | 3 -- .../structure-list-print.component.html | 7 --- .../structure-list-print.component.scss | 49 ------------------- .../structure-list-print.component.ts | 11 ----- src/styles.scss | 2 +- 7 files changed, 6 insertions(+), 84 deletions(-) delete mode 100644 src/app/shared/components/structure-list-print/structure-list-print.component.html delete mode 100644 src/app/shared/components/structure-list-print/structure-list-print.component.scss delete mode 100644 src/app/shared/components/structure-list-print/structure-list-print.component.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 1e510d4de..4d33f39f3 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -14,7 +14,6 @@ import { ResetEmailComponent } from './reset-email/reset-email.component'; import { ResetPasswordComponent } from './reset-password/reset-password.component'; import { StructureResolver } from './resolvers/structure.resolver'; import { PasswordFormComponent } from './shared/components'; -import { StructureListPrintComponent } from './shared/components/structure-list-print/structure-list-print.component'; import { StructureDetailsComponent } from './structure-list/components/structure-details/structure-details.component'; import { StructureListSearchPrintComponent } from './structure-list/components/structure-list-search-print/structure-list-search-print.component'; import { StructureListComponent } from './structure-list/structure-list.component'; @@ -39,17 +38,10 @@ const routes: Routes = [ { path: 'print', outlet: 'print', - children: [{ path: 'structure', component: StructureDetailsComponent }, footerOutletRoute], - }, - { - path: 'print', - outlet: 'print', - children: [{ path: 'structures', component: StructureListPrintComponent }, footerOutletRoute], - }, - { - path: 'print', - outlet: 'print', - children: [{ path: 'structures-search', component: StructureListSearchPrintComponent }, footerOutletRoute], + children: [ + { path: 'structure', component: StructureDetailsComponent }, + { path: 'structures-search', component: StructureListSearchPrintComponent }, + ], }, { path: 'acteurs', diff --git a/src/app/app.component.html b/src/app/app.component.html index 500e14908..88b82cf7c 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -7,8 +7,8 @@ <ng-container *ngIf="!loading"> <router-outlet name="left-pane"></router-outlet> <router-outlet></router-outlet> - <router-outlet name="print"></router-outlet> </ng-container> <router-outlet *ngIf="!loading" name="footer"></router-outlet> </div> </div> +<router-outlet name="print"></router-outlet> diff --git a/src/app/shared/components/index.ts b/src/app/shared/components/index.ts index 04859a36d..0f5424ca2 100644 --- a/src/app/shared/components/index.ts +++ b/src/app/shared/components/index.ts @@ -14,7 +14,6 @@ import { ModalJoinConfirmationComponent } from './modal-join-confirmation/modal- import { PasswordFormComponent } from './password-form/password-form.component'; import { RadioFormComponent } from './radio-form/radio-form.component'; import { StructureDetailPrintComponent } from './structure-detail-print/structure-detail-print.component'; -import { StructureListPrintComponent } from './structure-list-print/structure-list-print.component'; import { StructurePmrComponent } from './structure-pmr/structure-pmr.component'; import { StructureTypePickerComponent } from './structure-type-picker/structure-type-picker.component'; import { SvgIconComponent } from './svg-icon/svg-icon.component'; @@ -46,7 +45,6 @@ export { ProgressBarComponent, RadioFormComponent, StructureDetailPrintComponent, - StructureListPrintComponent, StructurePmrComponent, StructurePublicTargetComponent, StructureTypePickerComponent, @@ -78,7 +76,6 @@ export const SharedComponents = [ RadioFormComponent, RadioV3Component, StructureDetailPrintComponent, - StructureListPrintComponent, StructurePmrComponent, StructurePublicTargetComponent, StructureTypePickerComponent, diff --git a/src/app/shared/components/structure-list-print/structure-list-print.component.html b/src/app/shared/components/structure-list-print/structure-list-print.component.html deleted file mode 100644 index abd158620..000000000 --- a/src/app/shared/components/structure-list-print/structure-list-print.component.html +++ /dev/null @@ -1,7 +0,0 @@ -<div *ngFor="let structure of structures" class="multi-print"> - <app-structure-detail-print [structure]="structure" /> -</div> -<div class="loader" aria-busy="true"> - <img class="loader-gif" src="/assets/gif/loader_circle_grey.gif" alt /> - <p>Liste en cours d'impression</p> -</div> diff --git a/src/app/shared/components/structure-list-print/structure-list-print.component.scss b/src/app/shared/components/structure-list-print/structure-list-print.component.scss deleted file mode 100644 index 3eb08118d..000000000 --- a/src/app/shared/components/structure-list-print/structure-list-print.component.scss +++ /dev/null @@ -1,49 +0,0 @@ -@import 'color'; -@import 'layout'; - -.list-to-print { - height: 600px; - overflow-x: hidden; - overflow-y: auto; -} - -.multi-print { - :host { - background-color: $grey-9; - } - ::ng-deep { - .structure-details-container { - margin-top: 2%; - margin-left: 34%; - height: 98%; - } - .print-header { - height: 100%; - } - } - page-break-after: always; - print-color-adjust: exact; - width: 50%; - margin-left: 23%; - margin-right: 23%; - padding-left: 2%; - padding-right: 2%; - height: 100%; - overflow-x: hidden; - background-color: $white; - @media screen { - display: none; - } - @media print { - width: 100%; - margin: 0; - padding: 0; - } -} - -.loader { - height: calc(100vh - #{$header-height} - #{$footer-height}); - @media print { - display: none; - } -} diff --git a/src/app/shared/components/structure-list-print/structure-list-print.component.ts b/src/app/shared/components/structure-list-print/structure-list-print.component.ts deleted file mode 100644 index b03bfe5e6..000000000 --- a/src/app/shared/components/structure-list-print/structure-list-print.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { Structure } from '../../../models/structure.model'; - -@Component({ - selector: 'app-structure-list-print', - templateUrl: './structure-list-print.component.html', - styleUrls: ['./structure-list-print.component.scss'], -}) -export class StructureListPrintComponent { - @Input() public structures: Structure[]; -} diff --git a/src/styles.scss b/src/styles.scss index bdf5eb8f9..0a23b22c9 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -331,7 +331,7 @@ button { @media print { body, html, - .forPrint { + .root { height: auto; } -- GitLab From 5f8775dce1c9804029d95dca5b042137343c3246 Mon Sep 17 00:00:00 2001 From: Etienne LOUPIAS <eloupias@grandlyon.com> Date: Mon, 27 Nov 2023 15:40:32 +0100 Subject: [PATCH 4/4] revert temp color v3 --- src/styles.scss | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/styles.scss b/src/styles.scss index 0a23b22c9..6f462e364 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -608,17 +608,3 @@ button { white-space: nowrap !important; border: 0 !important; } - -// Status colors -.error { - color: $info-error; -} -.success { - color: $info-success; -} -.info { - color: $info-blue; -} -.warning { - color: $info-warning; -} -- GitLab