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 { PageCreationTeamComponent } from './pages/page-creation-team/page-creation-team.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
@ -71,6 +72,7 @@ import { PageCreationTeamComponent } from './pages/page-creation-team/page-creat
|
|||
PageAjoutContactComponent,
|
||||
PageModifierContactComponent,
|
||||
PageCreationTeamComponent,
|
||||
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
|
|
@ -4,6 +4,7 @@ export interface Membre {
|
|||
email: string;
|
||||
password: string;
|
||||
dateNaissance: Date;
|
||||
couleur: string;
|
||||
passwordConfirm: string;
|
||||
roleList: string[];
|
||||
}
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
<form (ngSubmit)="onSubmit()" [formGroup]="addMemberForm">
|
||||
<h1>J'inscris un nouveau membre</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">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
id="floatingInputlastName"
|
||||
|
@ -14,7 +19,7 @@
|
|||
[ngClass]="{'is-valid' : addMemberForm.controls['lastNameFc'].touched && addMemberForm.controls['lastNameFc'].valid,
|
||||
'is-invalid': addMemberForm.controls['lastNameFc'].touched && !addMemberForm.controls['lastNameFc'].valid}">
|
||||
<label for="floatingInputlastName">Avatar</label>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
class="form-control"
|
||||
|
@ -48,20 +53,7 @@
|
|||
'is-invalid': addMemberForm.controls['dateNaissanceFc'].touched && !addMemberForm.controls['dateNaissanceFc'].valid}">
|
||||
<label for="floatingInputfirstName">Date de naissance</label>
|
||||
</div>
|
||||
<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">
|
||||
<div class="form-floating">
|
||||
<input type="email"
|
||||
class="form-control"
|
||||
id="floatingInput"
|
||||
|
|
|
@ -27,7 +27,7 @@ export class PageAddMemberComponent implements OnInit {
|
|||
firstNameFc: new FormControl('', [Validators.required]),
|
||||
lastNameFc: new FormControl('', [Validators.required]),
|
||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||
profilFc: new FormControl('', [Validators.required]),
|
||||
couleurFc: new FormControl('', [Validators.required]),
|
||||
emailFc: new FormControl('', [
|
||||
Validators.email,
|
||||
Validators.required,
|
||||
|
@ -56,16 +56,16 @@ export class PageAddMemberComponent implements OnInit {
|
|||
const emailValue = this.addMemberForm.value['emailFc'];
|
||||
const passwordValue = this.addMemberForm.value['passwordFc'];
|
||||
const dateNaissanceValue = this.addMemberForm.value['dateNaissanceFc'];
|
||||
const teamNameValue = this.addMemberForm.value['teamNameFc'];
|
||||
const profilValue = this.addMemberForm.value['profilFc'];
|
||||
const couleurValue = this.addMemberForm.value['couleurFc'];
|
||||
const passwordConfirmValue = this.addMemberForm.value['passwordConfirmFc'];
|
||||
const teamValue = [''];
|
||||
|
||||
|
||||
const membre: Membre = {
|
||||
nom: firstNameValue,
|
||||
prenom: lastNameValue,
|
||||
email: emailValue,
|
||||
password: passwordValue,
|
||||
couleur: couleurValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
passwordConfirm: passwordConfirmValue,
|
||||
roleList: ["ROLE_PARENT"]
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<app-header></app-header>
|
||||
<div class="signin-form text-center">
|
||||
<main class="form-signin">
|
||||
<div class="reset-form text-center">
|
||||
<main class="form-reset">
|
||||
<form (ngSubmit)="onSubmit(resetForm)" #resetForm="ngForm">
|
||||
<h3>Entrez ici votre email et votre nouveau mot de passe</h3>
|
||||
<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'] != '' ,
|
||||
|
@ -14,9 +15,7 @@
|
|||
'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>
|
||||
|
||||
<button class="w-100 btn btn-outline-success" type="submit" [disabled]="resetForm.invalid">Enregistrer</button>
|
||||
|
||||
</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 { Router } from '@angular/router';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-page-reset-password',
|
||||
|
@ -6,21 +9,20 @@ import { Component, OnInit } from '@angular/core';
|
|||
styleUrls: ['./page-reset-password.component.scss']
|
||||
})
|
||||
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 {
|
||||
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']);
|
||||
const password = submittedForm.form.value['password'];
|
||||
const email = submittedForm.form.value['email'];
|
||||
console.log(email);
|
||||
this.authService.resetPassword(email, password).subscribe((resp: any) => {
|
||||
window.alert("Votre mot de passe est bien ré-initialisé !")
|
||||
this.router.navigate(['accueil']);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
<main class="form-signup">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
||||
<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">
|
||||
<input
|
||||
type="text"
|
||||
|
|
|
@ -32,6 +32,7 @@ export class PageSignupComponent implements OnInit {
|
|||
lastNameFc: new FormControl('', [Validators.required]),
|
||||
dateNaissanceFc: new FormControl('', [Validators.required]),
|
||||
roleFc: new FormControl(''),
|
||||
couleurFc: new FormControl('', Validators.required),
|
||||
emailFc: new FormControl('', [
|
||||
Validators.email,
|
||||
Validators.required,
|
||||
|
@ -61,6 +62,7 @@ export class PageSignupComponent implements OnInit {
|
|||
const passwordValue = this.signupForm.value['passwordFc'];
|
||||
const dateNaissanceValue = this.signupForm.value['dateNaissanceFc'];
|
||||
const passwordConfirmValue = this.signupForm.value['passwordConfirmFc'];
|
||||
const couleurValue = this.signupForm.value['couleurFc'];
|
||||
const roleValue = ['ROLE_PARENT'];
|
||||
|
||||
const membre: Membre = {
|
||||
|
@ -68,6 +70,7 @@ export class PageSignupComponent implements OnInit {
|
|||
prenom: prenomValue,
|
||||
email: emailValue,
|
||||
password: passwordValue,
|
||||
couleur: couleurValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
passwordConfirm: passwordConfirmValue,
|
||||
roleList: roleValue,
|
||||
|
|
|
@ -53,13 +53,13 @@ export class AuthService {
|
|||
const body = {
|
||||
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> {
|
||||
const body = 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> {
|
||||
|
|
Loading…
Reference in New Issue