+
+
+
+
+
+
+
+
+
+
+
Pseudo:
+
{{person.nickname}}
+
+
+
+
+
Mail:
+
{{person.email}}
+
+
+
+
+
Rôle:
+
+ utilisateur
+ admin
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/app/common/components/profil/page-profil/page-profil.component.scss b/frontend/src/app/common/components/page-profil/page-profil.component.scss
similarity index 100%
rename from frontend/src/app/common/components/profil/page-profil/page-profil.component.scss
rename to frontend/src/app/common/components/page-profil/page-profil.component.scss
diff --git a/frontend/src/app/common/components/profil/page-profil/page-profil.component.spec.ts b/frontend/src/app/common/components/page-profil/page-profil.component.spec.ts
similarity index 100%
rename from frontend/src/app/common/components/profil/page-profil/page-profil.component.spec.ts
rename to frontend/src/app/common/components/page-profil/page-profil.component.spec.ts
diff --git a/frontend/src/app/common/components/profil/page-profil/page-profil.component.ts b/frontend/src/app/common/components/page-profil/page-profil.component.ts
similarity index 63%
rename from frontend/src/app/common/components/profil/page-profil/page-profil.component.ts
rename to frontend/src/app/common/components/page-profil/page-profil.component.ts
index b4dce60..90f67bd 100644
--- a/frontend/src/app/common/components/profil/page-profil/page-profil.component.ts
+++ b/frontend/src/app/common/components/page-profil/page-profil.component.ts
@@ -1,10 +1,10 @@
import { Component, OnInit } from '@angular/core';
-import {Person} from "../../../interfaces/Person";
import {MatDialog} from "@angular/material/dialog";
import {MatSnackBar} from "@angular/material/snack-bar";
import {PopupUpdateProfilComponent} from "../popup-update-profil/popup-update-profil.component";
-import {FictitiousDatasService} from "../../../services/fictitiousDatas/fictitious-datas.service";
+import {FictitiousDatasService} from "../../services/fictitiousDatas/fictitious-datas.service";
import {Router} from "@angular/router";
+import {PopupDeleteProfilComponent} from "../popup-delete-profil/popup-delete-profil.component";
@@ -15,12 +15,12 @@ import {Router} from "@angular/router";
})
export class PageProfilComponent implements OnInit
{
- person: Person = {
+ person = {
id: "",
- login: "",
+ nickname: "",
email: "",
- hashPass: "",
- role: "user",
+ hash_pass: "",
+ is_admin: false,
};
from: string = "" ;
@@ -75,4 +75,36 @@ export class PageProfilComponent implements OnInit
}
}
+
+ // Appuie sur le bouton supprimer
+ onSupprimer(): void
+ {
+ const config = {
+ data: {
+ id: this.person.id,
+ email: this.person.email,
+ me: true,
+ }
+ };
+ this.dialog
+ .open(PopupDeleteProfilComponent, config)
+ .afterClosed()
+ .subscribe(retour => this.onSupprimerCallback(retour));
+ }
+
+
+ // Callback de onSupprimer
+ onSupprimerCallback(retour: any): void
+ {
+ if((retour === null) || (retour === undefined))
+ {
+ const config = { duration: 1000, panelClass: "custom-class" };
+ this.snackBar.open( "Opération annulé", "", config);
+ }
+ else
+ {
+ this.router.navigateByUrl("/login");
+ }
+ }
+
}
diff --git a/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.html b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.html
new file mode 100644
index 0000000..9118e3b
--- /dev/null
+++ b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.html
@@ -0,0 +1,14 @@
+
+ Êtes-vous sûr de vouloir supprimer votre compte ?
+
+
+
+
+ Êtes-vous sûr de vouloir supprimer {{email}} ?
+
+
+
+
+
+
+
diff --git a/frontend/src/app/admin/userList/popup-delete-person/popup-delete-person.component.scss b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.scss
similarity index 100%
rename from frontend/src/app/admin/userList/popup-delete-person/popup-delete-person.component.scss
rename to frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.scss
diff --git a/frontend/src/app/admin/userList/popup-delete-person/popup-delete-person.component.spec.ts b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.spec.ts
similarity index 50%
rename from frontend/src/app/admin/userList/popup-delete-person/popup-delete-person.component.spec.ts
rename to frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.spec.ts
index f45d4a1..8743fad 100644
--- a/frontend/src/app/admin/userList/popup-delete-person/popup-delete-person.component.spec.ts
+++ b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.spec.ts
@@ -1,20 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { PopupDeletePersonComponent } from './popup-delete-person.component';
+import { PopupDeleteProfilComponent } from './popup-delete-profil.component';
-describe('PopupDeletePersonComponent', () => {
- let component: PopupDeletePersonComponent;
- let fixture: ComponentFixture
;
+describe('PopupDeleteProfilComponent', () => {
+ let component: PopupDeleteProfilComponent;
+ let fixture: ComponentFixture;
beforeEach(async () => {
await TestBed.configureTestingModule({
- declarations: [ PopupDeletePersonComponent ]
+ declarations: [ PopupDeleteProfilComponent ]
})
.compileComponents();
});
beforeEach(() => {
- fixture = TestBed.createComponent(PopupDeletePersonComponent);
+ fixture = TestBed.createComponent(PopupDeleteProfilComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
diff --git a/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.ts b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.ts
new file mode 100644
index 0000000..e5efad8
--- /dev/null
+++ b/frontend/src/app/common/components/popup-delete-profil/popup-delete-profil.component.ts
@@ -0,0 +1,28 @@
+import {Component, Inject, OnInit} from '@angular/core';
+import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
+
+
+
+@Component({
+ selector: 'app-popup-delete-profil',
+ templateUrl: './popup-delete-profil.component.html',
+ styleUrls: ['./popup-delete-profil.component.scss']
+})
+export class PopupDeleteProfilComponent implements OnInit
+{
+ me: boolean = false; // on se supprime soi-même
+ email: string = "";
+
+ constructor( public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data: any ) { }
+
+ ngOnInit(): void {
+ this.me = this.data.me;
+ this.email = this.data.email;
+ }
+
+ onValider(): void {
+ this.dialogRef.close(true);
+ }
+
+}
diff --git a/frontend/src/app/common/components/profil/popup-update-profil/popup-update-profil.component.html b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.html
similarity index 97%
rename from frontend/src/app/common/components/profil/popup-update-profil/popup-update-profil.component.html
rename to frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.html
index 036c8b7..c28fe07 100644
--- a/frontend/src/app/common/components/profil/popup-update-profil/popup-update-profil.component.html
+++ b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.html
@@ -6,10 +6,10 @@
-
+
Pseudo
-
+
diff --git a/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.scss b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.scss
new file mode 100644
index 0000000..1317c7a
--- /dev/null
+++ b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.scss
@@ -0,0 +1,37 @@
+.boite {
+ font-size: small;
+}
+
+h3 {
+ text-align: center;
+}
+
+button {
+ font-size: small;
+}
+
+img {
+ margin: 0px 0px 10px 0px;
+ width: 5vw;
+ height: 5vw;
+ border: solid 2px black;
+ border-radius: 50%;
+ font-size: xxx-large;
+}
+
+// -------------------------------------------------------------------------
+
+// aura
+::ng-deep .mat-checkbox-ripple .mat-ripple-element {
+ background-color: grey !important;
+}
+
+// contenu coche
+::ng-deep .mat-checkbox-checked.mat-accent .mat-checkbox-background {
+ background-color: black !important;
+}
+
+// indeterminate
+::ng-deep .mat-checkbox .mat-checkbox-frame {
+ background-color: white !important;
+}
diff --git a/frontend/src/app/common/components/profil/popup-update-profil/popup-update-profil.component.spec.ts b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.spec.ts
similarity index 100%
rename from frontend/src/app/common/components/profil/popup-update-profil/popup-update-profil.component.spec.ts
rename to frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.spec.ts
diff --git a/frontend/src/app/common/components/profil/popup-update-profil/popup-update-profil.component.ts b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.ts
similarity index 84%
rename from frontend/src/app/common/components/profil/popup-update-profil/popup-update-profil.component.ts
rename to frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.ts
index f792fec..9753ac7 100644
--- a/frontend/src/app/common/components/profil/popup-update-profil/popup-update-profil.component.ts
+++ b/frontend/src/app/common/components/popup-update-profil/popup-update-profil.component.ts
@@ -1,8 +1,7 @@
import {Component, Inject, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
-import {Person} from "../../../interfaces/Person";
-import {CheckEmailService} from "../../../services/checkEmail/check-email.service";
-import {HashageService} from "../../../services/hashage/hashage.service";
+import {CheckEmailService} from "../../services/checkEmail/check-email.service";
+import {HashageService} from "../../services/hashage/hashage.service";
@@ -13,7 +12,7 @@ import {HashageService} from "../../../services/hashage/hashage.service";
})
export class PopupUpdateProfilComponent implements OnInit
{
- personCopy: Person;
+ personCopy: any;
newPassword: string = "";
confirmNewPassword: string = "" ;
changePassword: boolean = false ;
@@ -32,10 +31,10 @@ export class PopupUpdateProfilComponent implements OnInit
const person = this.data.person;
this.personCopy = {
id: person.id,
- login: person.login,
+ nickname: person.nickname,
email: person.email,
- hashPass: person.hashPass,
- role: person.role
+ hash_pass: person.hash_pass,
+ is_admin: person.is_admin
};
}
@@ -46,7 +45,7 @@ export class PopupUpdateProfilComponent implements OnInit
this.checkField();
if(!this.hasError)
{
- if(this.changePassword) this.personCopy.hashPass = this.hashageService.run(this.newPassword);
+ if(this.changePassword) this.personCopy.hash_pass = this.hashageService.run(this.newPassword);
const data = { user: this.personCopy };
// ...
@@ -75,7 +74,7 @@ export class PopupUpdateProfilComponent implements OnInit
// Check les champs saisis par l'utilisateur
checkField(): void
{
- if(this.personCopy.login.length === 0) {
+ if(this.personCopy.nickname.length === 0) {
this.errorMessage = "Veuillez remplir le champ 'pseudo'" ;
this.hasError = true;
}
diff --git a/frontend/src/app/common/components/profil/page-profil/page-profil.component.html b/frontend/src/app/common/components/profil/page-profil/page-profil.component.html
deleted file mode 100644
index 6767c47..0000000
--- a/frontend/src/app/common/components/profil/page-profil/page-profil.component.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
Pseudo:
-
{{person.login}}
-
-
-
-
-
Mail:
-
{{person.email}}
-
-
-
-
-
Rôle:
-
- utilisateur
- admin
-
-
-
-
-
-
-
-
-
-
-
diff --git a/frontend/src/app/common/interfaces/Person.ts b/frontend/src/app/common/interfaces/Person.ts
deleted file mode 100644
index ab25968..0000000
--- a/frontend/src/app/common/interfaces/Person.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-// user or admin
-export interface Person
-{
- id: string,
- login: string,
- email: string,
- hashPass: string,
- role: string,
-}
diff --git a/frontend/src/app/common/services/fictitiousDatas/fictitious-datas.service.ts b/frontend/src/app/common/services/fictitiousDatas/fictitious-datas.service.ts
index 4cb751e..e4eb760 100644
--- a/frontend/src/app/common/services/fictitiousDatas/fictitious-datas.service.ts
+++ b/frontend/src/app/common/services/fictitiousDatas/fictitious-datas.service.ts
@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
-import {Person} from "../../interfaces/Person";
+
@Injectable({
providedIn: 'root'
@@ -7,33 +7,33 @@ import {Person} from "../../interfaces/Person";
export class FictitiousDatasService
{
- getUser(): Person
+ getUser()
{
const id = (Math.floor(Math.random()*100000)).toString()
return {
id: id,
- login: "Riri"+id,
+ nickname: "Riri"+id,
email: "riri"+id+"@gmail.com",
- hashPass: "blablabla",
- role: "user",
+ hash_pass: "blablabla",
+ is_admin: false,
}
}
- getAdmin(): Person
+ getAdmin()
{
const id = (Math.floor(Math.random()*100000)).toString()
return {
id: id,
- login: "Fifi"+id,
+ nickname: "Fifi"+id,
email: "fifi"+id+"@gmail.com",
- hashPass: "blablabla",
- role: "admin",
+ hash_pass: "blablabla",
+ is_admin: true,
}
}
- getTabPerson(n: number): Person[]
+ getTabPerson(n: number)
{
- let tab: Person[] = [];
+ let tab = [];
for(let i=0 ; i
{
+ let service: ProfilService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(ProfilService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/frontend/src/app/common/services/profil/profil.service.ts b/frontend/src/app/common/services/profil/profil.service.ts
new file mode 100644
index 0000000..213c1f3
--- /dev/null
+++ b/frontend/src/app/common/services/profil/profil.service.ts
@@ -0,0 +1,9 @@
+import { Injectable } from '@angular/core';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class ProfilService {
+
+ constructor() { }
+}
diff --git a/frontend/src/app/login/page-login/page-login.component.html b/frontend/src/app/login/page-login/page-login.component.html
index 8510729..493e7b7 100644
--- a/frontend/src/app/login/page-login/page-login.component.html
+++ b/frontend/src/app/login/page-login/page-login.component.html
@@ -3,7 +3,7 @@
-
+
diff --git a/frontend/src/app/login/page-login/page-login.component.ts b/frontend/src/app/login/page-login/page-login.component.ts
index 8caff6f..0076521 100644
--- a/frontend/src/app/login/page-login/page-login.component.ts
+++ b/frontend/src/app/login/page-login/page-login.component.ts
@@ -6,7 +6,7 @@ import {HashageService} from "../../common/services/hashage/hashage.service";
@Component({
- selector: 'app-page-login',
+ selector: 'app-page-nickname',
templateUrl: './page-login.component.html',
styleUrls: ['./page-login.component.scss']
})
@@ -31,7 +31,7 @@ export class PageLoginComponent
{
let data = {
email: this.email,
- hashPass: this.hashageService.run(this.password)
+ hash_pass: this.hashageService.run(this.password)
};
console.log(data);
/*
diff --git a/frontend/src/app/register/page-register/page-register.component.html b/frontend/src/app/register/page-register/page-register.component.html
index 0f08b14..b2ca879 100644
--- a/frontend/src/app/register/page-register/page-register.component.html
+++ b/frontend/src/app/register/page-register/page-register.component.html
@@ -8,10 +8,10 @@
-
+
Pseudo
-
+
diff --git a/frontend/src/app/register/page-register/page-register.component.ts b/frontend/src/app/register/page-register/page-register.component.ts
index 22b376e..d3ccf85 100644
--- a/frontend/src/app/register/page-register/page-register.component.ts
+++ b/frontend/src/app/register/page-register/page-register.component.ts
@@ -1,5 +1,4 @@
import { Component } from '@angular/core';
-import {Person} from "../../common/interfaces/Person";
import {HashageService} from "../../common/services/hashage/hashage.service";
import {Router} from "@angular/router";
import {CheckEmailService} from "../../common/services/checkEmail/check-email.service";
@@ -15,11 +14,11 @@ import {PopupConfirmRegisterComponent} from "../popup-confirm-register/popup-con
})
export class PageRegisterComponent
{
- person: Person = {
+ person = {
id: "",
- login: "",
+ nickname: "",
email: "",
- hashPass: "",
+ hash_pass: "",
role: "user"
};
password: string = "";
@@ -40,7 +39,7 @@ export class PageRegisterComponent
this.checkField();
if(!this.hasError)
{
- this.person.hashPass = this.hashageService.run(this.password);
+ this.person.hash_pass = this.hashageService.run(this.password);
// FAUX CODE
const retour = { status: "succes", data: {} };
@@ -76,7 +75,7 @@ export class PageRegisterComponent
// Check les champs saisis par l'utilisateur
checkField(): void
{
- if(this.person.login.length === 0) {
+ if(this.person.nickname.length === 0) {
this.errorMessage = "Veuillez remplir le champ 'pseudo'.";
this.hasError = true;
}
diff --git a/frontend/src/app/user/commentary.txt b/frontend/src/app/user/myProfil/commentary.txt
similarity index 65%
rename from frontend/src/app/user/commentary.txt
rename to frontend/src/app/user/myProfil/commentary.txt
index f1df163..902847e 100644
--- a/frontend/src/app/user/commentary.txt
+++ b/frontend/src/app/user/myProfil/commentary.txt
@@ -1,7 +1,7 @@
-La partie utilisateur est composé uniquement d'une page contenant:
+La page "admin/myProfil" contient:
- les informations de l'utilisateur (composant "page-profil")
- un bouton "modifier profil" pour modifier les informations de l'utilisateur (composant "popup-update-profil")
-Cette page est la même que la page "Mon Profil" de la partie admin.
+Cette page est la même que la page de la partie admin.
Ainsi, on a rangé cette page dans le dossier "common/components/profil".
diff --git a/frontend/src/app/user/page-registry/page-registry.component.html b/frontend/src/app/user/page-registry/page-registry.component.html
new file mode 100644
index 0000000..6c7f471
--- /dev/null
+++ b/frontend/src/app/user/page-registry/page-registry.component.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+ Filter
+
+
+
+
+
+
+
+
+
+ | Pseudo |
+ {{person.nickname}} |
+
+
+
+
+ Email |
+ {{person.email}} |
+
+
+
+
+ Rôle |
+ {{person.role}} |
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/app/user/page-registry/page-registry.component.scss b/frontend/src/app/user/page-registry/page-registry.component.scss
new file mode 100644
index 0000000..7440dcb
--- /dev/null
+++ b/frontend/src/app/user/page-registry/page-registry.component.scss
@@ -0,0 +1,9 @@
+mat-paginator, table {
+ width: 80%;
+ margin: auto 10%;
+}
+
+.filtre {
+ text-align: center;
+ width: 33%;
+}
diff --git a/frontend/src/app/user/page-registry/page-registry.component.spec.ts b/frontend/src/app/user/page-registry/page-registry.component.spec.ts
new file mode 100644
index 0000000..1851010
--- /dev/null
+++ b/frontend/src/app/user/page-registry/page-registry.component.spec.ts
@@ -0,0 +1,25 @@
+import { ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { PageRegistryComponent } from './page-registry.component';
+
+describe('RegistryComponent', () => {
+ let component: PageRegistryComponent;
+ let fixture: ComponentFixture
;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ PageRegistryComponent ]
+ })
+ .compileComponents();
+ });
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(PageRegistryComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/frontend/src/app/user/page-registry/page-registry.component.ts b/frontend/src/app/user/page-registry/page-registry.component.ts
new file mode 100644
index 0000000..6d0e1b9
--- /dev/null
+++ b/frontend/src/app/user/page-registry/page-registry.component.ts
@@ -0,0 +1,50 @@
+import {AfterViewInit, Component, ViewChild} from '@angular/core';
+import {MatTableDataSource} from "@angular/material/table";
+import {MatSort} from "@angular/material/sort";
+import {MatPaginator} from "@angular/material/paginator";
+import {FictitiousDatasService} from "../../common/services/fictitiousDatas/fictitious-datas.service";
+import {MatDialog} from "@angular/material/dialog";
+
+
+
+@Component({
+ selector: 'app-page-registry',
+ templateUrl: './page-registry.component.html',
+ styleUrls: ['./page-registry.component.scss']
+})
+export class PageRegistryComponent implements AfterViewInit
+{
+ displayedColumns: string[] = [ "nickname", "email", "role" ];
+ dataSource: MatTableDataSource;
+ @ViewChild(MatSort) sort: MatSort;
+ @ViewChild(MatPaginator) paginator: MatPaginator;
+
+
+ constructor( private fictitiousDatasService: FictitiousDatasService,
+ public dialog: MatDialog ) { }
+
+
+ ngAfterViewInit(): void
+ {
+ // Faux code
+ let tabPerson = this.fictitiousDatasService.getTabPerson(5);
+
+ // Vrai code ...
+
+ tabPerson = tabPerson.map( person => {
+ if(!person.is_admin) return Object.assign(person, {role: "utilisateur"});
+ else return Object.assign(person, {role: "admin"});
+ });
+ this.dataSource = new MatTableDataSource(tabPerson);
+ this.dataSource.sort = this.sort;
+ this.dataSource.paginator = this.paginator;
+ }
+
+
+ applyFilter(event: Event)
+ {
+ const filterValue = (event.target as HTMLInputElement).value;
+ this.dataSource.filter = filterValue.trim().toLowerCase();
+ }
+
+}