['dateOfBirth' non obligatoire] + [popup forgotten password]
This commit is contained in:
parent
a70574a8e2
commit
7a0d1136a9
30 changed files with 262 additions and 454 deletions
|
|
@ -144,11 +144,6 @@
|
|||
<button mat-icon-button (click)="onVisualizeImages(advert)">
|
||||
<mat-icon> insert_photo</mat-icon>
|
||||
</button>
|
||||
<!--
|
||||
<button mat-icon-button (click)="onVisualizeInfo(advert)">
|
||||
<mat-icon>aspect_ratio</mat-icon>
|
||||
</button>
|
||||
-->
|
||||
<button mat-icon-button (click)="onDelete(advert)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
<div [class]="themeService.getClassTheme()">
|
||||
|
||||
<h1 mat-dialog-title>{{advert.title}}</h1>
|
||||
|
||||
<!-- ----------------------------------------------------------------------------------------------------------------- -->
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
<mat-dialog-content>
|
||||
|
||||
<!-- URL -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel"> Annonceur: </div>
|
||||
<div class="col-6 myValue"> {{advert.url}} </div>
|
||||
</div>
|
||||
|
||||
<!-- Images -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel"> Images: </div>
|
||||
<div class="col-6 myValue" style="border-left: solid 1px #e6e6e6">
|
||||
<div *ngFor="let image of advert.images"> {{image.url}} </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tags -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel"> Tags: </div>
|
||||
<div class="col-6 myValue" style="border-left: solid 1px #e6e6e6">
|
||||
<div *ngFor="let interest of advert.interests"> {{interest}} </div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Comment -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel"> Commentaire: </div>
|
||||
<div class="col-6 myValue"> {{advert.comment}} </div>
|
||||
</div>
|
||||
|
||||
<!-- Views -->
|
||||
<div class="row myRow">
|
||||
<label class="col-6 myLabel"> Vues: </label>
|
||||
<div class="col-6 myValue"> {{advert.views}} </div>
|
||||
</div>
|
||||
|
||||
<!-- Created at -->
|
||||
<div class="row myRow">
|
||||
<label class="col-6 myLabel"> Date de création: </label>
|
||||
<div class="col-6 myValue">
|
||||
{{ advert.createdAt | date:'dd/LL/YYYY à HH:mm:ss' }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Last updtade -->
|
||||
<div class="row myRow">
|
||||
<label class="col-6 myLabel"> Date de dernière modification: </label>
|
||||
<div class="col-6 myValue">
|
||||
{{ advert.updatedAt | date:'dd/LL/YYYY à HH:mm:ss' }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- IsVisible -->
|
||||
<div class="row myRow">
|
||||
<label class="col-6 myLabel"> Visibilité: </label>
|
||||
<div class="col-6 myValue">
|
||||
<mat-icon *ngIf="advert.isVisible">checked</mat-icon>
|
||||
<mat-icon *ngIf="!advert.isVisible">close</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</mat-dialog-content>
|
||||
|
||||
<!-- ----------------------------------------------------------------------------------------------------------------- -->
|
||||
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button (click)="dialogRef.close()">Fermer</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
</div>
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
.lightTheme, .darkTheme {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: xx-large;
|
||||
}
|
||||
|
||||
|
||||
.myRow {
|
||||
margin: 15px 0px 15px 0px;
|
||||
}
|
||||
|
||||
|
||||
.myLabel {
|
||||
text-align: right;
|
||||
padding: 0px 5px 0px 0px;
|
||||
margin: 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.myValue {
|
||||
text-align: left;
|
||||
padding: 0px 0px 0px 5px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PopupVisualizeAdAdminComponent } from './popup-visualize-ad-admin.component';
|
||||
|
||||
describe('PopupVisualizeAdAdminComponent', () => {
|
||||
let component: PopupVisualizeAdAdminComponent;
|
||||
let fixture: ComponentFixture<PopupVisualizeAdAdminComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PopupVisualizeAdAdminComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PopupVisualizeAdAdminComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {Advert} from "../../../utils/interfaces/advert";
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-popup-visualize-ad-admin',
|
||||
templateUrl: './popup-visualize-ad-admin.component.html',
|
||||
styleUrls: ['./popup-visualize-ad-admin.component.scss']
|
||||
})
|
||||
export class PopupVisualizeAdAdminComponent implements OnInit
|
||||
{
|
||||
advert: Advert;
|
||||
|
||||
constructor( public dialogRef: MatDialogRef<PopupVisualizeAdAdminComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data,
|
||||
public themeService: ThemeService ) { }
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.advert = this.data.advert;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ export class PopupUpdateAdminComponent implements OnInit
|
|||
_id: admin0._id,
|
||||
login: admin0.login,
|
||||
hashPass: admin0.hashPass,
|
||||
email: admin0.mail,
|
||||
email: admin0.email,
|
||||
role: {
|
||||
name: admin0.role.name,
|
||||
permission: admin0.role.permission,
|
||||
|
|
@ -79,15 +79,14 @@ export class PopupUpdateAdminComponent implements OnInit
|
|||
this.errorMessage = "Email invalide" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.changePassword) {
|
||||
if (this.newPassword.length === 0) {
|
||||
else if((this.changePassword) && (this.newPassword.length === 0)) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'mot de passe'" ;
|
||||
this.hasError = true;
|
||||
} else if (this.newPassword !== this.confirmNewPassword) {
|
||||
}
|
||||
else if((this.changePassword) && (this.newPassword !== this.confirmNewPassword)) {
|
||||
this.errorMessage = "Le mot de passe est différent de sa confirmation" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.errorMessage = "" ;
|
||||
this.hasError = false;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<!-- ------------------------------------------------------------------------------------ -->
|
||||
|
||||
<mat-label>Tags</mat-label>
|
||||
<mat-label>Centres d'intérêt</mat-label>
|
||||
|
||||
<!-- ------------------------------------------------------------------------------------ -->
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@
|
|||
<ng-container matColumnDef="dateOfBirth">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Date de naissance </th>
|
||||
<td mat-cell *matCellDef="let user">
|
||||
{{ user.dateOfBirth | date:'dd/LL/YYYY' }}
|
||||
<span *ngIf="((user.dateOfBirth === null) || (user.dateOfBirth === undefined)); else elseDateOfBirth"></span>
|
||||
<ng-template #elseDateOfBirth> {{ user.dateOfBirth | date:'dd/LL/YYYY' }} </ng-template>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
@ -125,7 +126,8 @@
|
|||
<ng-container matColumnDef="age">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Âge </th>
|
||||
<td mat-cell *matCellDef="let user">
|
||||
{{user.age}}
|
||||
<span *ngIf="(user.age < 0) ; else elseAge"></span>
|
||||
<ng-template #elseAge> {{user.age}} </ng-template>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
@ -133,8 +135,8 @@
|
|||
<ng-container matColumnDef="sexe">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Sexe </th>
|
||||
<td mat-cell *matCellDef="let user">
|
||||
<span *ngIf="user.gender === 'man'">H</span>
|
||||
<span *ngIf="user.gender === 'woman'">F</span>
|
||||
<span *ngIf="(user.gender === 'man') ; else elseSexe"> H </span>
|
||||
<ng-template #elseSexe> F </ng-template>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
|
@ -143,8 +145,8 @@
|
|||
<th mat-header-cell *matHeaderCellDef> Centres d'intérêt </th>
|
||||
<td mat-cell *matCellDef="let user">
|
||||
<span *ngFor="let interest of user.interests; let isLast = last;">
|
||||
<span *ngIf="!isLast"> {{interest}}, </span>
|
||||
<span *ngIf="isLast"> {{interest}} </span>
|
||||
<span *ngIf="!isLast ; else elseInterests"> {{interest}}, </span>
|
||||
<ng-template #elseInterests> {{interest}} </ng-template>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
|
@ -173,19 +175,6 @@
|
|||
</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Delete Column -->
|
||||
<ng-container matColumnDef="actions">
|
||||
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
||||
<td mat-cell *matCellDef="let user">
|
||||
<button mat-icon-button (click)="onVisualize(user)">
|
||||
<mat-icon>aspect_ratio</mat-icon>
|
||||
</button>
|
||||
<button mat-icon-button (click)="onDelete(user)">
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<!-- Directives -->
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import {MatDialog} from "@angular/material/dialog";
|
|||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {MatTableDataSource} from "@angular/material/table";
|
||||
import {User} from "../../../utils/interfaces/user";
|
||||
import {PopupVisualizeUserComponent} from "../popup-visualize-user/popup-visualize-user.component";
|
||||
import {PopupDeleteUserComponent} from "../popup-delete-user/popup-delete-user.component";
|
||||
import {PopupCreateUserComponent} from "../popup-create-user/popup-create-user.component";
|
||||
import {FictitiousUsersService} from "../../../utils/services/fictitiousDatas/fictitiousUsers/fictitious-users.service";
|
||||
|
|
@ -66,19 +65,6 @@ export class PageUserListComponent implements AfterViewInit
|
|||
}
|
||||
|
||||
|
||||
onVisualize(user: User): void
|
||||
{
|
||||
const config = {
|
||||
width: '50%',
|
||||
data: { user: user }
|
||||
};
|
||||
this.dialog
|
||||
.open(PopupVisualizeUserComponent, config)
|
||||
.afterClosed()
|
||||
.subscribe(retour => {});
|
||||
}
|
||||
|
||||
|
||||
onDelete(user: User): void
|
||||
{
|
||||
const config = {
|
||||
|
|
@ -139,10 +125,13 @@ export class PageUserListComponent implements AfterViewInit
|
|||
|
||||
getAge(date: Date): number
|
||||
{
|
||||
if((date === null) || (date === undefined)) return -1;
|
||||
else {
|
||||
const diff = Date.now() - date.getTime();
|
||||
const age = new Date(diff);
|
||||
return Math.abs(age.getUTCFullYear() - 1970);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
onFilter(): void
|
||||
|
|
|
|||
|
|
@ -85,10 +85,6 @@ export class PopupCreateUserComponent implements OnInit
|
|||
this.errorMessage = "Le mot de passe est différent de sa confirmation.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if((this.user.role.name === 'user') && ((this.user.dateOfBirth === undefined) || (this.user.dateOfBirth === null))) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'date de naissance'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if((this.user.role.name === 'advertiser') && (this.user.company.length === 0)) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'entreprise'.";
|
||||
this.hasError = true;
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
<div class="myContainer">
|
||||
|
||||
<!-- Photo de profil -->
|
||||
<div style="text-align: center">
|
||||
<img [src]="user.profilePictureUrl"
|
||||
onerror="this.onerror=null; this.src='assets/profil.png'">
|
||||
</div>
|
||||
|
||||
<!-- login -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Login:</div>
|
||||
<div class="col-6 myValue"> {{user.login}} </div>
|
||||
</div>
|
||||
|
||||
<!-- email -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Mail:</div>
|
||||
<div class="col-6 myValue"> {{user.email}} </div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="user.role.name === 'user'">
|
||||
|
||||
<!-- dateOfBirth -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Date de naissance:</div>
|
||||
<div class="col-6 myValue">{{ user.dateOfBirth | date:'dd/LL/YYYY' }}</div>
|
||||
</div>
|
||||
|
||||
<!-- age -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Âge:</div>
|
||||
<div class="col-6 myValue">{{user.age}}</div>
|
||||
</div>
|
||||
|
||||
<!-- gender -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Sexe:</div>
|
||||
<div class="col-6 myValue">
|
||||
<span *ngIf="user.gender==='man'"> Homme </span>
|
||||
<span *ngIf="user.gender==='woman'"> Femme </span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- interets -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Centres d'intérêt:</div>
|
||||
<div class="col-6 myValue" style="border-left: solid 1px #e6e6e6">
|
||||
<div *ngFor="let interest of user.interests">• {{interest}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- createdAt -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Date de création:</div>
|
||||
<div class="col-6 myValue">{{ user.createdAt | date:'dd/LL/YYYY' }}</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Role -->
|
||||
<div class="row myRow">
|
||||
<div class="col-6 myLabel">Rôle:</div>
|
||||
<div class="col-6 myValue">
|
||||
<span *ngIf="user.role.name === 'user'">Utilisateur</span>
|
||||
<span *ngIf="user.role.name === 'url'">Annonceur</span>
|
||||
<span *ngIf="user.role.name === 'admin'">Admin</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<!-- boutons -->
|
||||
<div style="text-align: center">
|
||||
<button mat-button (click)="this.dialogRef.close(null)"> Fermer </button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
.myContainer {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
|
||||
img {
|
||||
margin: 0px 0px 10px 0px;
|
||||
width: 5vw;
|
||||
height: 5vw;
|
||||
border: solid 2px black;
|
||||
border-radius: 50%;
|
||||
font-size: xxx-large;
|
||||
}
|
||||
|
||||
|
||||
.myRow {
|
||||
margin: 15px 0px 15px 0px;
|
||||
}
|
||||
.myLabel {
|
||||
text-align: right;
|
||||
padding: 0px 5px 0px 0px;
|
||||
margin: 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.myValue {
|
||||
text-align: left;
|
||||
padding: 0px 0px 0px 5px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PopupVisualizeUserComponent } from './popup-visualize-user.component';
|
||||
|
||||
describe('PopupVisualizeUserComponent', () => {
|
||||
let component: PopupVisualizeUserComponent;
|
||||
let fixture: ComponentFixture<PopupVisualizeUserComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PopupVisualizeUserComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PopupVisualizeUserComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
import {Component, Inject, OnInit} from '@angular/core';
|
||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-popup-visualize-user',
|
||||
templateUrl: './popup-visualize-user.component.html',
|
||||
styleUrls: ['./popup-visualize-user.component.scss']
|
||||
})
|
||||
export class PopupVisualizeUserComponent implements OnInit
|
||||
{
|
||||
user;
|
||||
|
||||
constructor( public dialogRef: MatDialogRef<PopupVisualizeUserComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data ) { }
|
||||
|
||||
ngOnInit(): void
|
||||
{
|
||||
this.user = this.data.user;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -84,6 +84,8 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
|
|||
{
|
||||
const config = {
|
||||
width: '75%',
|
||||
height: '80%',
|
||||
panelClass: 'custom-dialog-container',
|
||||
data: { action: "add", advert: null }
|
||||
};
|
||||
this.dialog
|
||||
|
|
@ -111,6 +113,8 @@ export class PageAdListAdvertiserComponent implements AfterViewInit
|
|||
{
|
||||
const config = {
|
||||
width: '75%',
|
||||
height: '80%',
|
||||
panelClass: 'custom-dialog-container',
|
||||
data: { action: "update", advert: advertToUpdate }
|
||||
};
|
||||
this.dialog
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<div [class]="themeService.getClassTheme()">
|
||||
<div class="myContainer1">
|
||||
<div class="myContainer2">
|
||||
|
||||
<!-- titre popup -->
|
||||
<h1 mat-dialog-title>{{title}}</h1>
|
||||
|
|
@ -70,7 +71,9 @@
|
|||
<!-- Actions -->
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button (click)="dialogRef.close()">Annuler</button>
|
||||
<button mat-button (click)="onValidate()" cdkFocusInitial>Valider</button>
|
||||
<button mat-button (click)="onValidate()">Valider</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,24 @@
|
|||
.lightTheme, .darkTheme {
|
||||
background-image: none;
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
.myContainer1 {
|
||||
padding: 10px 10px 0px 25px;
|
||||
margin: 0px 0px 0px 0px;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
|
||||
.myContainer2 {
|
||||
padding: 0px 0px 0px 0px;
|
||||
margin: 0px 0px 0px 0px;
|
||||
overflow-y: hidden;
|
||||
overflow-x: hidden;
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.myContainer2::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
font-size: large;
|
||||
|
|
@ -26,6 +40,10 @@ h1 {
|
|||
border: solid 1px grey;
|
||||
}
|
||||
|
||||
mat-dialog-actions {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
button {
|
||||
font-size: small;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export class PopupUpdateAdvertiserComponent implements OnInit
|
|||
_id: advertiser0._id,
|
||||
login: advertiser0.login,
|
||||
hashPass: advertiser0.hashPass,
|
||||
email: advertiser0.mail,
|
||||
email: advertiser0.email,
|
||||
role: {
|
||||
name: advertiser0.role.name,
|
||||
permission: advertiser0.role.permission,
|
||||
|
|
@ -79,15 +79,14 @@ export class PopupUpdateAdvertiserComponent implements OnInit
|
|||
this.errorMessage = "Email invalide" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.changePassword) {
|
||||
if (this.newPassword.length === 0) {
|
||||
else if((this.changePassword) && (this.newPassword.length === 0)) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'mot de passe'" ;
|
||||
this.hasError = true;
|
||||
} else if (this.newPassword !== this.confirmNewPassword) {
|
||||
}
|
||||
else if((this.changePassword) && (this.newPassword !== this.confirmNewPassword)) {
|
||||
this.errorMessage = "Le mot de passe est différent de sa confirmation" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.errorMessage = "" ;
|
||||
this.hasError = false;
|
||||
|
|
|
|||
|
|
@ -60,10 +60,8 @@ import { InputInterestsRegisterComponent } from './beforeConnexion/register/inpu
|
|||
import {MatPaginatorModule} from "@angular/material/paginator";
|
||||
import { PageAdListAdminComponent } from './admin/adList/page-ad-list-admin/page-ad-list-admin.component';
|
||||
import { PopupDeleteAdAdminComponent } from './admin/adList/popup-delete-ad-admin/popup-delete-ad-admin.component';
|
||||
import { PopupVisualizeAdAdminComponent } from './admin/adList/popup-visualize-ad-admin/popup-visualize-ad-admin.component';
|
||||
import { PopupVisualizeImagesAdminComponent } from './admin/adList/popup-visualize-images-admin/popup-visualize-images-admin.component';
|
||||
import { PageUserListComponent } from './admin/userList/page-user-list/page-user-list.component';
|
||||
import { PopupVisualizeUserComponent } from './admin/userList/popup-visualize-user/popup-visualize-user.component';
|
||||
import { PopupDeleteUserComponent } from './admin/userList/popup-delete-user/popup-delete-user.component';
|
||||
import { PopupCreateUserComponent } from './admin/userList/popup-create-user/popup-create-user.component';
|
||||
import { InputInterestsAdminComponent } from './admin/userList/input-interests-admin/input-interests-admin.component';
|
||||
|
|
@ -72,6 +70,7 @@ import {MatDatepickerModule} from "@angular/material/datepicker";
|
|||
import { PagesPopularityComponent } from './advertiser/pages-popularity/pages-popularity.component';
|
||||
import { ChartsModule } from 'ng2-charts';
|
||||
import { PopupDeletePlaylistComponent } from './user/myPlaylists/popup-delete-playlist/popup-delete-playlist.component';
|
||||
import { PopupForgottenPasswordComponent } from './beforeConnexion/login/popup-forgotten-password/popup-forgotten-password.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
|
|
@ -112,16 +111,15 @@ import { PopupDeletePlaylistComponent } from './user/myPlaylists/popup-delete-pl
|
|||
InputInterestsRegisterComponent,
|
||||
PageAdListAdminComponent,
|
||||
PopupDeleteAdAdminComponent,
|
||||
PopupVisualizeAdAdminComponent,
|
||||
PopupVisualizeImagesAdminComponent,
|
||||
PageUserListComponent,
|
||||
PopupVisualizeUserComponent,
|
||||
PopupDeleteUserComponent,
|
||||
PopupCreateUserComponent,
|
||||
InputInterestsAdminComponent,
|
||||
PageWatchingVideoComponent,
|
||||
PagesPopularityComponent,
|
||||
PopupDeletePlaylistComponent,
|
||||
PopupForgottenPasswordComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<!-- Oubli mot de passe -->
|
||||
<div id="formFooter">
|
||||
<a class="underlineHover" href="https://disney.fandom.com/fr/wiki/Tristesse">J'ai oublié mon mot de passe</a>
|
||||
<a class="underlineHover" (click)="onForgottenPassword()">J'ai oublié mon mot de passe</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ import {Component, OnInit} from '@angular/core';
|
|||
import {MessageService} from "../../../utils/services/message/message.service";
|
||||
import {Router} from "@angular/router";
|
||||
import {ThemeService} from "../../../utils/services/theme/theme.service";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {PopupForgottenPasswordComponent} from "../popup-forgotten-password/popup-forgotten-password.component";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
|
||||
|
||||
|
||||
|
|
@ -20,7 +23,9 @@ export class PageLoginComponent implements OnInit
|
|||
|
||||
constructor( private messageService: MessageService,
|
||||
private router: Router,
|
||||
public themeService: ThemeService ) { }
|
||||
public themeService: ThemeService,
|
||||
public dialog: MatDialog,
|
||||
private snackBar: MatSnackBar ) { }
|
||||
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
|
@ -43,6 +48,21 @@ export class PageLoginComponent implements OnInit
|
|||
}
|
||||
|
||||
|
||||
onForgottenPassword(): void
|
||||
{
|
||||
this.dialog
|
||||
.open(PopupForgottenPasswordComponent, {width: '30%'})
|
||||
.afterClosed()
|
||||
.subscribe(result => {
|
||||
if((result !== null) && (result !== undefined))
|
||||
{
|
||||
const config = { duration: 5000, panelClass: "custom-class" };
|
||||
this.snackBar.open( "Un mail de réinitialisation de mot de passe vous a été envoyé.", "", config);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
maCallback(retour): void
|
||||
{
|
||||
console.log(retour.data)
|
||||
|
|
@ -72,6 +92,7 @@ export class PageLoginComponent implements OnInit
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Fonction de hashage (faible)
|
||||
hashage(input: string): string
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
<h4>Oubli mot de passe</h4>
|
||||
|
||||
<mat-divider></mat-divider><br>
|
||||
|
||||
<!-- email -->
|
||||
<div class="myDiv">
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Email</mat-label>
|
||||
<input matInput type="email" [(ngModel)]="email" required>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<!-- message d'erreur -->
|
||||
<div class="myError" *ngIf="hasError">
|
||||
<span class="mat-error">{{errorMessage}}</span>
|
||||
</div>
|
||||
|
||||
<mat-divider></mat-divider>
|
||||
|
||||
<!-- boutons -->
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-button (click)="dialogRef.close()">Annuler</button>
|
||||
<button mat-button (click)="onValidate()" cdkFocusInitial>Valider</button>
|
||||
</mat-dialog-actions>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
h4 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.myDiv {
|
||||
text-align: center;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
.myError {
|
||||
text-align: center;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PopupForgottenPasswordComponent } from './popup-forgotten-password.component';
|
||||
|
||||
describe('PopupForgottenPasswordComponent', () => {
|
||||
let component: PopupForgottenPasswordComponent;
|
||||
let fixture: ComponentFixture<PopupForgottenPasswordComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ PopupForgottenPasswordComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(PopupForgottenPasswordComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
import { Component } from '@angular/core';
|
||||
import {MatDialogRef} from "@angular/material/dialog";
|
||||
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-popup-forgotten-password',
|
||||
templateUrl: './popup-forgotten-password.component.html',
|
||||
styleUrls: ['./popup-forgotten-password.component.scss']
|
||||
})
|
||||
export class PopupForgottenPasswordComponent
|
||||
{
|
||||
email: string;
|
||||
hasError: boolean = false;
|
||||
errorMessage: string = "";
|
||||
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<PopupForgottenPasswordComponent>) {}
|
||||
|
||||
|
||||
// Click sur valider
|
||||
onValidate()
|
||||
{
|
||||
if(this.email.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'email'." ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(!this.isValidEmail(this.email)) {
|
||||
this.errorMessage = "Email invalide." ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else {
|
||||
this.errorMessage = "" ;
|
||||
this.hasError = false;
|
||||
this.dialogRef.close(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Indique si email a bien le format d'un email
|
||||
isValidEmail(email): boolean
|
||||
{
|
||||
let re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
return re.test(email);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
<mat-label>Date de naissance</mat-label>
|
||||
<input matInput type="date"
|
||||
[ngModel] ="user.dateOfBirth | date:'yyyy-MM-dd'"
|
||||
(ngModelChange)="user.dateOfBirth = $event" required>
|
||||
(ngModelChange)="user.dateOfBirth = $event">
|
||||
</mat-form-field>
|
||||
|
||||
<!-- interests -->
|
||||
|
|
|
|||
|
|
@ -119,10 +119,6 @@ export class PageRegisterComponent
|
|||
this.errorMessage = "Le mot de passe est différent de sa confirmation.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else if((this.user.role.name === 'user') && ((this.user.dateOfBirth === undefined) || (this.user.dateOfBirth === null))) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'date de naissance'.";
|
||||
this.hasError = true;
|
||||
}
|
||||
else {
|
||||
this.errorMessage = "" ;
|
||||
this.hasError = false;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import {Router} from "@angular/router";
|
|||
|
||||
|
||||
interface VideoHistory {
|
||||
videoId: string,
|
||||
imageUrl: string,
|
||||
title: string,
|
||||
date: Date,
|
||||
|
|
@ -115,6 +116,7 @@ export class PageHistoryUserComponent implements AfterViewInit
|
|||
videoAllToVideoHistory(videoAll: VideoAll): VideoHistory
|
||||
{
|
||||
return {
|
||||
videoId: videoAll.videoId,
|
||||
imageUrl: videoAll.imageUrl,
|
||||
title: videoAll.title,
|
||||
date: videoAll.watchedDates[videoAll.watchedDates.length-1],
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export class PopupUpdateUserComponent implements OnInit
|
|||
_id: user0._id,
|
||||
login: user0.login,
|
||||
hashPass: user0.hashPass,
|
||||
email: user0.mail,
|
||||
email: user0.email,
|
||||
role: {
|
||||
name: user0.role.name,
|
||||
permission: user0.role.permission,
|
||||
|
|
@ -79,18 +79,13 @@ export class PopupUpdateUserComponent implements OnInit
|
|||
this.errorMessage = "Email invalide." ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if((this.userCopy.dateOfBirth === undefined) || (this.userCopy.dateOfBirth === null)) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'date de naissance'.";
|
||||
else if((this.changePassword) && (this.newPassword.length === 0)) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'mot de passe'" ;
|
||||
this.hasError = true;
|
||||
}
|
||||
else if(this.changePassword) {
|
||||
if (this.newPassword.length === 0) {
|
||||
this.errorMessage = "Veuillez remplir le champ 'mot de passe'." ;
|
||||
else if((this.changePassword) && (this.newPassword !== this.confirmNewPassword)) {
|
||||
this.errorMessage = "Le mot de passe est différent de sa confirmation" ;
|
||||
this.hasError = true;
|
||||
} else if (this.newPassword !== this.confirmNewPassword) {
|
||||
this.errorMessage = "Le mot de passe est différent de sa confirmation." ;
|
||||
this.hasError = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.errorMessage = "" ;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@ body { margin: 0; }
|
|||
}
|
||||
|
||||
|
||||
.custom-dialog-container .mat-dialog-container {
|
||||
margin: 0px 0px 0px 0px;
|
||||
padding: 0px 0px 0px 0px;
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Reference in a new issue