reset password en cours
This commit is contained in:
parent
673887a81c
commit
b994e6be58
5 changed files with 173 additions and 79 deletions
|
@ -26,7 +26,7 @@ const routes: Routes = [
|
||||||
{ path: 'password-oublie', component: PageForgotPasswordComponent },
|
{ path: 'password-oublie', component: PageForgotPasswordComponent },
|
||||||
{ path: 'menu', component: PageMenuSemaineComponent },
|
{ path: 'menu', component: PageMenuSemaineComponent },
|
||||||
{ path: 'repertoire', component: PageRepertoireComponent },
|
{ path: 'repertoire', component: PageRepertoireComponent },
|
||||||
{ path: 'reset-password', component: PageResetPasswordComponent },
|
{ path: 'reinitialisation-password', component: PageResetPasswordComponent },
|
||||||
{ path: 'creation-compte', component: PageSignupComponent },
|
{ path: 'creation-compte', component: PageSignupComponent },
|
||||||
{ path: 'to-do-list', component: PageToDoListComponent },
|
{ path: 'to-do-list', component: PageToDoListComponent },
|
||||||
{ path: 'modifier-membre', component: PageUpdateMemberComponent },
|
{ path: 'modifier-membre', component: PageUpdateMemberComponent },
|
||||||
|
|
|
@ -1 +1,26 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
|
<div class="signin-form text-center">
|
||||||
|
<main class="form-signin">
|
||||||
|
<form (ngSubmit)="onSubmit(resetForm)" #resetForm="ngForm">
|
||||||
|
<div class="form-floating">
|
||||||
|
<input type="email" class="form-control" id="floatingEmail" placeholder="" name="email" ngModel required
|
||||||
|
[ngClass]="{'is-valid': resetForm.form.touched && resetForm.form.value['email'] != '' ,
|
||||||
|
'is-invalid': resetForm.form.touched && resetForm.form.value['email'] == ''}">
|
||||||
|
<label for="floatingEmail">Email</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-floating">
|
||||||
|
<input type="password" class="form-control" id="floatingPassword" placeholder="" name="password" ngModel
|
||||||
|
required [ngClass]="{'is-valid': resetForm.form.touched && resetForm.form.value['password'] != '' ,
|
||||||
|
'is-invalid': resetForm.form.touched && resetForm.form.value['password'] == ''}">
|
||||||
|
<label for="floatingPassword">Mot de passe</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="w-100 btn btn-lg btn-success" type="submit" [disabled]="resetForm.invalid">Se connecter</button>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,21 @@ import { Component, OnInit } from '@angular/core';
|
||||||
styleUrls: ['./page-reset-password.component.scss']
|
styleUrls: ['./page-reset-password.component.scss']
|
||||||
})
|
})
|
||||||
export class PageResetPasswordComponent implements OnInit {
|
export class PageResetPasswordComponent implements OnInit {
|
||||||
|
authService: any;
|
||||||
|
router: any;
|
||||||
|
|
||||||
constructor() { }
|
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']);
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,78 +2,129 @@
|
||||||
<div class="signup-form text-center">
|
<div class="signup-form text-center">
|
||||||
<main class="form-signup">
|
<main class="form-signup">
|
||||||
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
||||||
<h1>Incrivez-vous !</h1>
|
<h1>Inscrivez-vous !</h1>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input
|
||||||
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingInputlastName"
|
id="floatingInputlastName"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
name="lastName"
|
name="lastName"
|
||||||
formControlName="lastNameFc"
|
formControlName="lastNameFc"
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['lastNameFc'].touched && signupForm.controls['lastNameFc'].valid,
|
[ngClass]="{
|
||||||
'is-invalid': signupForm.controls['lastNameFc'].touched && !signupForm.controls['lastNameFc'].valid}">
|
'is-valid':
|
||||||
|
signupForm.controls['lastNameFc'].touched &&
|
||||||
|
signupForm.controls['lastNameFc'].valid,
|
||||||
|
'is-invalid':
|
||||||
|
signupForm.controls['lastNameFc'].touched &&
|
||||||
|
!signupForm.controls['lastNameFc'].valid
|
||||||
|
}"
|
||||||
|
/>
|
||||||
<label for="floatingInputlastName">Nom</label>
|
<label for="floatingInputlastName">Nom</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input
|
||||||
|
type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingInputfirstName"
|
id="floatingInputfirstName"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
name="firstName"
|
name="firstName"
|
||||||
formControlName="firstNameFc"
|
formControlName="firstNameFc"
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['firstNameFc'].touched && signupForm.controls['firstNameFc'].valid,
|
[ngClass]="{
|
||||||
'is-invalid': signupForm.controls['firstNameFc'].touched && !signupForm.controls['firstNameFc'].valid}">
|
'is-valid':
|
||||||
|
signupForm.controls['firstNameFc'].touched &&
|
||||||
|
signupForm.controls['firstNameFc'].valid,
|
||||||
|
'is-invalid':
|
||||||
|
signupForm.controls['firstNameFc'].touched &&
|
||||||
|
!signupForm.controls['firstNameFc'].valid
|
||||||
|
}"
|
||||||
|
/>
|
||||||
<label for="floatingInputfirstName">Prénom</label>
|
<label for="floatingInputfirstName">Prénom</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="date"
|
<input
|
||||||
|
type="date"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingInputdateNaissance"
|
id="floatingInputdateNaissance"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
name="dateNaissance"
|
name="dateNaissance"
|
||||||
formControlName="dateNaissanceFc"
|
formControlName="dateNaissanceFc"
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['dateNaissanceFc'].touched && signupForm.controls['dateNaissanceFc'].valid,
|
[ngClass]="{
|
||||||
'is-invalid': signupForm.controls['dateNaissanceFc'].touched && !signupForm.controls['dateNaissanceFc'].valid}">
|
'is-valid':
|
||||||
|
signupForm.controls['dateNaissanceFc'].touched &&
|
||||||
|
signupForm.controls['dateNaissanceFc'].valid,
|
||||||
|
'is-invalid':
|
||||||
|
signupForm.controls['dateNaissanceFc'].touched &&
|
||||||
|
!signupForm.controls['dateNaissanceFc'].valid
|
||||||
|
}"
|
||||||
|
/>
|
||||||
<label for="floatingInputfirstName">Date de naissance</label>
|
<label for="floatingInputfirstName">Date de naissance</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="email"
|
<input
|
||||||
|
type="email"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingInput"
|
id="floatingInput"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
name="email"
|
name="email"
|
||||||
formControlName="emailFc"
|
formControlName="emailFc"
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['emailFc'].touched && signupForm.controls['emailFc'].valid,
|
[ngClass]="{
|
||||||
'is-invalid': signupForm.controls['emailFc'].touched && !signupForm.controls['emailFc'].valid}">
|
'is-valid':
|
||||||
|
signupForm.controls['emailFc'].touched &&
|
||||||
|
signupForm.controls['emailFc'].valid,
|
||||||
|
'is-invalid':
|
||||||
|
signupForm.controls['emailFc'].touched &&
|
||||||
|
!signupForm.controls['emailFc'].valid
|
||||||
|
}"
|
||||||
|
/>
|
||||||
<label for="floatingInput">Adresse email</label>
|
<label for="floatingInput">Adresse email</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="password"
|
<input
|
||||||
|
type="password"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingPassword"
|
id="floatingPassword"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
name="password"
|
name="password"
|
||||||
formControlName="passwordFc"
|
formControlName="passwordFc"
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['passwordFc'].touched && signupForm.controls['passwordFc'].valid,
|
[ngClass]="{
|
||||||
'is-invalid': signupForm.controls['passwordFc'].touched && !signupForm.controls['passwordFc'].valid}">
|
'is-valid':
|
||||||
|
signupForm.controls['passwordFc'].touched &&
|
||||||
|
signupForm.controls['passwordFc'].valid,
|
||||||
|
'is-invalid':
|
||||||
|
signupForm.controls['passwordFc'].touched &&
|
||||||
|
!signupForm.controls['passwordFc'].valid
|
||||||
|
}"
|
||||||
|
/>
|
||||||
<label for="floatingPassword">Mot de passe</label>
|
<label for="floatingPassword">Mot de passe</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="passwordConfirm"
|
<input
|
||||||
|
type="passwordConfirm"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingpasswordConfirm"
|
id="floatingpasswordConfirm"
|
||||||
placeholder=""
|
placeholder=""
|
||||||
name="passwordConfirm"
|
name="passwordConfirm"
|
||||||
formControlName="passwordConfirmFc"
|
formControlName="passwordConfirmFc"
|
||||||
[ngClass]="{'is-valid' : signupForm.controls['passwordConfirmFc'].touched && signupForm.controls['passwordConfirmFc'].valid,
|
[ngClass]="{
|
||||||
'is-invalid': signupForm.controls['passwordConfirmFc'].touched && !signupForm.controls['passwordConfirmFc'].valid}">
|
'is-valid':
|
||||||
|
signupForm.controls['passwordConfirmFc'].touched &&
|
||||||
|
signupForm.controls['passwordConfirmFc'].valid,
|
||||||
|
'is-invalid':
|
||||||
|
signupForm.controls['passwordConfirmFc'].touched &&
|
||||||
|
!signupForm.controls['passwordConfirmFc'].valid
|
||||||
|
}"
|
||||||
|
/>
|
||||||
<label for="floatingPassword">Confirmer mot de passe</label>
|
<label for="floatingPassword">Confirmer mot de passe</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="w-100 btn btn-lg btn-success"
|
<button
|
||||||
|
class="w-100 btn btn-lg btn-success"
|
||||||
type="submit"
|
type="submit"
|
||||||
[disabled]="signupForm.invalid">Je m'inscris !</button>
|
[disabled]="signupForm.invalid"
|
||||||
|
>
|
||||||
|
Je m'inscris !
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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 { Injectable } from '@angular/core';
|
||||||
import { map, Observable } from 'rxjs';
|
import { map, Observable } from 'rxjs';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
|
@ -51,4 +52,10 @@ export class AuthService {
|
||||||
};
|
};
|
||||||
return this.http.post(`${this.apiUrl}/membres/forgot-password`, body);
|
return this.http.post(`${this.apiUrl}/membres/forgot-password`, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetPassword(email: string, password: string): Observable<any> {
|
||||||
|
const body = password;
|
||||||
|
console.log(password);
|
||||||
|
return this.http.post(`${this.apiUrl}/membres/reset-password/${email}`, body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue