reset-password terminé
This commit is contained in:
parent
ef3418b45c
commit
7102d73f89
|
@ -1,5 +1,2 @@
|
||||||
{
|
{
|
||||||
"workbench.colorCustomizations": {
|
|
||||||
"titleBar.activeBackground": "#4950a1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ import { PageAjoutContactComponent } from './pages/page-ajout-contact/page-ajout
|
||||||
import { PageModifierContactComponent } from './pages/page-modifier-contact/page-modifier-contact.component';
|
import { PageModifierContactComponent } from './pages/page-modifier-contact/page-modifier-contact.component';
|
||||||
import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component';
|
import { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component';
|
||||||
|
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
|
@ -71,6 +72,7 @@ import { PageCreationTeamComponent } from './pages/page-creation-team/page-creat
|
||||||
PageAjoutContactComponent,
|
PageAjoutContactComponent,
|
||||||
PageModifierContactComponent,
|
PageModifierContactComponent,
|
||||||
PageCreationTeamComponent,
|
PageCreationTeamComponent,
|
||||||
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
|
|
@ -4,6 +4,7 @@ export interface Membre {
|
||||||
email: string;
|
email: string;
|
||||||
password: string;
|
password: string;
|
||||||
dateNaissance: Date;
|
dateNaissance: Date;
|
||||||
|
couleur: string;
|
||||||
passwordConfirm: string;
|
passwordConfirm: string;
|
||||||
roleList: string[];
|
roleList: string[];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,11 @@
|
||||||
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
|
||||||
<h1>J'inscris un nouveau membre</h1>
|
<h1>J'inscris un nouveau membre</h1>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
|
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
|
||||||
|
formControlName="couleurFc">
|
||||||
|
<label for="floatingInputcouleur">Choisissez une couleur !</label>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="form-floating">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingInputlastName"
|
id="floatingInputlastName"
|
||||||
|
@ -14,7 +19,7 @@
|
||||||
[ngClass]="{'is-valid' : addMemberForm.controls['lastNameFc'].touched && addMemberForm.controls['lastNameFc'].valid,
|
[ngClass]="{'is-valid' : addMemberForm.controls['lastNameFc'].touched && addMemberForm.controls['lastNameFc'].valid,
|
||||||
'is-invalid': addMemberForm.controls['lastNameFc'].touched && !addMemberForm.controls['lastNameFc'].valid}">
|
'is-invalid': addMemberForm.controls['lastNameFc'].touched && !addMemberForm.controls['lastNameFc'].valid}">
|
||||||
<label for="floatingInputlastName">Avatar</label>
|
<label for="floatingInputlastName">Avatar</label>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
|
@ -48,20 +53,7 @@
|
||||||
'is-invalid': addMemberForm.controls['dateNaissanceFc'].touched && !addMemberForm.controls['dateNaissanceFc'].valid}">
|
'is-invalid': addMemberForm.controls['dateNaissanceFc'].touched && !addMemberForm.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">
|
||||||
<select type="text"
|
|
||||||
class="form-control"
|
|
||||||
id="floatingInputprofil"
|
|
||||||
name="profil"
|
|
||||||
formControlName="profilFc"
|
|
||||||
[ngClass]="{'is-valid' : addMemberForm.controls['profilFc'].touched && addMemberForm.controls['profilFc'].valid,
|
|
||||||
'is-invalid': addMemberForm.controls['profilFc'].touched && !addMemberForm.controls['profilFc'].valid}">
|
|
||||||
<option>Adulte</option>
|
|
||||||
<option>Enfant</option>
|
|
||||||
</select>
|
|
||||||
<label for="floatingInputfirstName">Profil</label>
|
|
||||||
</div>
|
|
||||||
<div class="form-floating">
|
|
||||||
<input type="email"
|
<input type="email"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
id="floatingInput"
|
id="floatingInput"
|
||||||
|
|
|
@ -27,7 +27,7 @@ export class PageAddMemberComponent implements OnInit {
|
||||||
firstNameFc: new FormControl('', [Validators.required]),
|
firstNameFc: new FormControl('', [Validators.required]),
|
||||||
lastNameFc: new FormControl('', [Validators.required]),
|
lastNameFc: new FormControl('', [Validators.required]),
|
||||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||||
profilFc: new FormControl('', [Validators.required]),
|
couleurFc: new FormControl('', [Validators.required]),
|
||||||
emailFc: new FormControl('', [
|
emailFc: new FormControl('', [
|
||||||
Validators.email,
|
Validators.email,
|
||||||
Validators.required,
|
Validators.required,
|
||||||
|
@ -56,16 +56,16 @@ export class PageAddMemberComponent implements OnInit {
|
||||||
const emailValue = this.addMemberForm.value['emailFc'];
|
const emailValue = this.addMemberForm.value['emailFc'];
|
||||||
const passwordValue = this.addMemberForm.value['passwordFc'];
|
const passwordValue = this.addMemberForm.value['passwordFc'];
|
||||||
const dateNaissanceValue = this.addMemberForm.value['dateNaissanceFc'];
|
const dateNaissanceValue = this.addMemberForm.value['dateNaissanceFc'];
|
||||||
const teamNameValue = this.addMemberForm.value['teamNameFc'];
|
const couleurValue = this.addMemberForm.value['couleurFc'];
|
||||||
const profilValue = this.addMemberForm.value['profilFc'];
|
|
||||||
const passwordConfirmValue = this.addMemberForm.value['passwordConfirmFc'];
|
const passwordConfirmValue = this.addMemberForm.value['passwordConfirmFc'];
|
||||||
const teamValue = [''];
|
|
||||||
|
|
||||||
const membre: Membre = {
|
const membre: Membre = {
|
||||||
nom: firstNameValue,
|
nom: firstNameValue,
|
||||||
prenom: lastNameValue,
|
prenom: lastNameValue,
|
||||||
email: emailValue,
|
email: emailValue,
|
||||||
password: passwordValue,
|
password: passwordValue,
|
||||||
|
couleur: couleurValue,
|
||||||
dateNaissance: dateNaissanceValue,
|
dateNaissance: dateNaissanceValue,
|
||||||
passwordConfirm: passwordConfirmValue,
|
passwordConfirm: passwordConfirmValue,
|
||||||
roleList: ["ROLE_PARENT"]
|
roleList: ["ROLE_PARENT"]
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<app-header></app-header>
|
<app-header></app-header>
|
||||||
<div class="signin-form text-center">
|
<div class="reset-form text-center">
|
||||||
<main class="form-signin">
|
<main class="form-reset">
|
||||||
<form (ngSubmit)="onSubmit(resetForm)" #resetForm="ngForm">
|
<form (ngSubmit)="onSubmit(resetForm)" #resetForm="ngForm">
|
||||||
|
<h3>Entrez ici votre email et votre nouveau mot de passe</h3>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="email" class="form-control" id="floatingEmail" placeholder="" name="email" ngModel required
|
<input type="email" class="form-control" id="floatingEmail" placeholder="" name="email" ngModel required
|
||||||
[ngClass]="{'is-valid': resetForm.form.touched && resetForm.form.value['email'] != '' ,
|
[ngClass]="{'is-valid': resetForm.form.touched && resetForm.form.value['email'] != '' ,
|
||||||
|
@ -14,9 +15,7 @@
|
||||||
'is-invalid': resetForm.form.touched && resetForm.form.value['password'] == ''}">
|
'is-invalid': resetForm.form.touched && resetForm.form.value['password'] == ''}">
|
||||||
<label for="floatingPassword">Mot de passe</label>
|
<label for="floatingPassword">Mot de passe</label>
|
||||||
</div>
|
</div>
|
||||||
|
<button class="w-100 btn btn-outline-success" type="submit" [disabled]="resetForm.invalid">Enregistrer</button>
|
||||||
<button class="w-100 btn btn-lg btn-success" type="submit" [disabled]="resetForm.invalid">Se connecter</button>
|
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
.reset-form {
|
||||||
|
height: 100vh;
|
||||||
|
padding-top: 40px;
|
||||||
|
background-color: #ffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-reset {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 330px;
|
||||||
|
padding: 15px;
|
||||||
|
margin: auto;
|
||||||
|
border: solid 1px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: #fcddec;
|
||||||
|
border-color: #ef5da8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-reset .checkbox {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-reset .form-floating:focus-within {
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-reset input[type="email"] {
|
||||||
|
margin-bottom: -1px;
|
||||||
|
border-bottom-right-radius: 0;
|
||||||
|
border-bottom-left-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-reset input[type="password"] {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-top-left-radius: 0;
|
||||||
|
border-top-right-radius: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-outline-success {
|
||||||
|
background-color: #ffff;
|
||||||
|
color: #ef5da8 !important;
|
||||||
|
border-color: #ef5da8 !important;
|
||||||
|
}
|
|
@ -1,4 +1,7 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { AuthService } from 'src/app/services/auth.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-page-reset-password',
|
selector: 'app-page-reset-password',
|
||||||
|
@ -6,21 +9,20 @@ 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(private authService: AuthService, private router: Router,) { }
|
||||||
|
|
||||||
ngOnInit(): void {}
|
ngOnInit(): void { }
|
||||||
|
|
||||||
public onSubmit(submittedForm: any): void {
|
public onSubmit(submittedForm: any): void {
|
||||||
console.log(submittedForm.form.value);
|
console.log(submittedForm.form.value);
|
||||||
const password = submittedForm.form.value['password'];
|
const password = submittedForm.form.value['password'];
|
||||||
const email = submittedForm.form.value['email'];
|
const email = submittedForm.form.value['email'];
|
||||||
console.log(email);
|
console.log(email);
|
||||||
this.authService.resetPassword(email, password).subscribe((resp: any) => {
|
this.authService.resetPassword(email, password).subscribe((resp: any) => {
|
||||||
this.router.navigate(['tableau-de-bord']);
|
window.alert("Votre mot de passe est bien ré-initialisé !")
|
||||||
|
this.router.navigate(['accueil']);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
<main class="form-signup">
|
<main class="form-signup">
|
||||||
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
||||||
<h1>Inscrivez-vous !</h1>
|
<h1>Inscrivez-vous !</h1>
|
||||||
|
<div class="form-floating">
|
||||||
|
<input type="color" class="form-control" id="floatingInputcouleur" placeholder="" name="couleur"
|
||||||
|
formControlName="couleurFc" >
|
||||||
|
<label for="floatingInputcouleur">Choisissez une couleur !</label>
|
||||||
|
</div>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|
|
@ -32,6 +32,7 @@ export class PageSignupComponent implements OnInit {
|
||||||
lastNameFc: new FormControl('', [Validators.required]),
|
lastNameFc: new FormControl('', [Validators.required]),
|
||||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||||
roleFc: new FormControl(''),
|
roleFc: new FormControl(''),
|
||||||
|
couleurFc: new FormControl('', Validators.required),
|
||||||
emailFc: new FormControl('', [
|
emailFc: new FormControl('', [
|
||||||
Validators.email,
|
Validators.email,
|
||||||
Validators.required,
|
Validators.required,
|
||||||
|
@ -61,6 +62,7 @@ export class PageSignupComponent implements OnInit {
|
||||||
const passwordValue = this.signupForm.value['passwordFc'];
|
const passwordValue = this.signupForm.value['passwordFc'];
|
||||||
const dateNaissanceValue = this.signupForm.value['dateNaissanceFc'];
|
const dateNaissanceValue = this.signupForm.value['dateNaissanceFc'];
|
||||||
const passwordConfirmValue = this.signupForm.value['passwordConfirmFc'];
|
const passwordConfirmValue = this.signupForm.value['passwordConfirmFc'];
|
||||||
|
const couleurValue = this.signupForm.value['couleurFc'];
|
||||||
const roleValue = ['ROLE_PARENT'];
|
const roleValue = ['ROLE_PARENT'];
|
||||||
|
|
||||||
const membre: Membre = {
|
const membre: Membre = {
|
||||||
|
@ -68,6 +70,7 @@ export class PageSignupComponent implements OnInit {
|
||||||
prenom: prenomValue,
|
prenom: prenomValue,
|
||||||
email: emailValue,
|
email: emailValue,
|
||||||
password: passwordValue,
|
password: passwordValue,
|
||||||
|
couleur: couleurValue,
|
||||||
dateNaissance: dateNaissanceValue,
|
dateNaissance: dateNaissanceValue,
|
||||||
passwordConfirm: passwordConfirmValue,
|
passwordConfirm: passwordConfirmValue,
|
||||||
roleList: roleValue,
|
roleList: roleValue,
|
||||||
|
|
|
@ -53,13 +53,13 @@ export class AuthService {
|
||||||
const body = {
|
const body = {
|
||||||
email: email,
|
email: email,
|
||||||
};
|
};
|
||||||
return this.http.post(`${this.apiUrl}/membres/forgot-password`, body);
|
return this.http.get(`${this.apiUrl}/membres/forgot-password`);
|
||||||
}
|
}
|
||||||
|
|
||||||
resetPassword(email: string, password: string): Observable<any> {
|
resetPassword(email: string, password: string): Observable<any> {
|
||||||
const body = password;
|
const body = password;
|
||||||
console.log(password);
|
console.log(password);
|
||||||
return this.http.post(`${this.apiUrl}/membres/reset-password/${email}`, body);
|
return this.http.put(`${this.apiUrl}/membres/reset-password/${email}`, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
creationTeam(team: Team): Observable<any> {
|
creationTeam(team: Team): Observable<any> {
|
||||||
|
|
Loading…
Reference in New Issue