From b994e6be58a671dc6f77ac0bc128904cac808a74 Mon Sep 17 00:00:00 2001
From: Blandine Bajard <83599148+BlandineBajard@users.noreply.github.com>
Date: Fri, 21 Jan 2022 12:30:05 +0100
Subject: [PATCH 1/2] reset password en cours
---
src/app/app-routing.module.ts | 2 +-
.../page-reset-password.component.html | 25 +++
.../page-reset-password.component.ts | 15 +-
.../page-signup/page-signup.component.html | 201 +++++++++++-------
src/app/services/auth.service.ts | 9 +-
5 files changed, 173 insertions(+), 79 deletions(-)
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 0fd65f1..ac4db0b 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -26,7 +26,7 @@ const routes: Routes = [
{ path: 'password-oublie', component: PageForgotPasswordComponent },
{ path: 'menu', component: PageMenuSemaineComponent },
{ path: 'repertoire', component: PageRepertoireComponent },
- { path: 'reset-password', component: PageResetPasswordComponent },
+ { path: 'reinitialisation-password', component: PageResetPasswordComponent },
{ path: 'creation-compte', component: PageSignupComponent },
{ path: 'to-do-list', component: PageToDoListComponent },
{ path: 'modifier-membre', component: PageUpdateMemberComponent },
diff --git a/src/app/pages/page-reset-password/page-reset-password.component.html b/src/app/pages/page-reset-password/page-reset-password.component.html
index e91fa55..5d8cd73 100644
--- a/src/app/pages/page-reset-password/page-reset-password.component.html
+++ b/src/app/pages/page-reset-password/page-reset-password.component.html
@@ -1 +1,26 @@
+
+
diff --git a/src/app/pages/page-reset-password/page-reset-password.component.ts b/src/app/pages/page-reset-password/page-reset-password.component.ts
index f721fa0..897d3a2 100644
--- a/src/app/pages/page-reset-password/page-reset-password.component.ts
+++ b/src/app/pages/page-reset-password/page-reset-password.component.ts
@@ -6,10 +6,21 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./page-reset-password.component.scss']
})
export class PageResetPasswordComponent implements OnInit {
+ authService: any;
+ router: any;
constructor() { }
- ngOnInit(): void {
- }
+ ngOnInit(): void {}
+ public onSubmit(submittedForm: any): void {
+ console.log(submittedForm.form.value);
+ const password = submittedForm.form.value['password'];
+ const email = submittedForm.form.value['email'];
+ console.log(email);
+ this.authService.resetPassword(email, password).subscribe((resp: any) => {
+ this.router.navigate(['tableau-de-bord']);
+
+ });
+}
}
diff --git a/src/app/pages/page-signup/page-signup.component.html b/src/app/pages/page-signup/page-signup.component.html
index d4f3544..63e736c 100644
--- a/src/app/pages/page-signup/page-signup.component.html
+++ b/src/app/pages/page-signup/page-signup.component.html
@@ -1,79 +1,130 @@
diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts
index 0402524..2ed543c 100644
--- a/src/app/services/auth.service.ts
+++ b/src/app/services/auth.service.ts
@@ -1,4 +1,5 @@
-import { HttpClient } from '@angular/common/http';
+import { HttpClient, HttpHeaders } from '@angular/common/http';
+import { identifierModuleUrl } from '@angular/compiler';
import { Injectable } from '@angular/core';
import { map, Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
@@ -51,4 +52,10 @@ export class AuthService {
};
return this.http.post(`${this.apiUrl}/membres/forgot-password`, body);
}
+
+ resetPassword(email: string, password: string): Observable {
+ const body = password;
+ console.log(password);
+ return this.http.post(`${this.apiUrl}/membres/reset-password/${email}`, body);
+ }
}
From 20459365eeded94c82fffe856f5085fdadad5230 Mon Sep 17 00:00:00 2001
From: Blandine Bajard <83599148+BlandineBajard@users.noreply.github.com>
Date: Fri, 21 Jan 2022 12:54:22 +0100
Subject: [PATCH 2/2] corrections
---
src/app/models/membre.ts | 3 ---
.../page-add-member.component.ts | 1 -
.../pages/page-signup/page-signup.component.ts | 18 ++----------------
3 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/src/app/models/membre.ts b/src/app/models/membre.ts
index e2da4de..acad742 100644
--- a/src/app/models/membre.ts
+++ b/src/app/models/membre.ts
@@ -4,9 +4,6 @@ export interface Membre {
email: string;
password: string;
dateNaissance: Date;
- profil: boolean;
- roleList: string[];
-
passwordConfirm: string;
roleList: string[];
}
diff --git a/src/app/pages/page-add-member/page-add-member.component.ts b/src/app/pages/page-add-member/page-add-member.component.ts
index 426a262..e750e97 100644
--- a/src/app/pages/page-add-member/page-add-member.component.ts
+++ b/src/app/pages/page-add-member/page-add-member.component.ts
@@ -67,7 +67,6 @@ export class PageAddMemberComponent implements OnInit {
email: emailValue,
password: passwordValue,
dateNaissance: dateNaissanceValue,
- profil: profilValue,
passwordConfirm: passwordConfirmValue,
roleList: ["ROLE_PARENT"]
};
diff --git a/src/app/pages/page-signup/page-signup.component.ts b/src/app/pages/page-signup/page-signup.component.ts
index 4e80ea4..c31228f 100644
--- a/src/app/pages/page-signup/page-signup.component.ts
+++ b/src/app/pages/page-signup/page-signup.component.ts
@@ -25,7 +25,7 @@ export class PageSignupComponent implements OnInit {
}
ngOnInit(): void {
- // *********************************penser a changer group car déprécié********************************
+ // *********************************pensser a changer group car déprécié********************************
this.signupForm = this.fb.group(
{
firstNameFc: new FormControl('', [Validators.required]),
@@ -61,30 +61,16 @@ export class PageSignupComponent implements OnInit {
const passwordValue = this.signupForm.value['passwordFc'];
const dateNaissanceValue = this.signupForm.value['dateNaissanceFc'];
const passwordConfirmValue = this.signupForm.value['passwordConfirmFc'];
-
const roleValue = ['ROLE_PARENT'];
const membre: Membre = {
- prenom: prenomValue,
nom: nomValue,
+ prenom: prenomValue,
email: emailValue,
password: passwordValue,
dateNaissance: dateNaissanceValue,
passwordConfirm: passwordConfirmValue,
roleList: roleValue,
-
- const teamValue = '';
-
- const membre: Membre = {
- nom: firstNameValue,
- prenom: lastNameValue,
- email: emailValue,
- password: passwordValue,
- dateNaissance: dateNaissanceValue,
- profil: profilValue,
- passwordConfirm: passwordConfirmValue,
- roleList: ["ROLE_PARENT"]
-
};
if (membre.email !== '' && membre.password !== '') {