commit
0550e1b239
|
@ -28,7 +28,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 },
|
||||
|
|
|
@ -4,9 +4,6 @@ export interface Membre {
|
|||
email: string;
|
||||
password: string;
|
||||
dateNaissance: Date;
|
||||
profil: boolean;
|
||||
roleList: string[];
|
||||
|
||||
passwordConfirm: string;
|
||||
roleList: string[];
|
||||
}
|
||||
|
|
|
@ -67,7 +67,6 @@ export class PageAddMemberComponent implements OnInit {
|
|||
email: emailValue,
|
||||
password: passwordValue,
|
||||
dateNaissance: dateNaissanceValue,
|
||||
profil: profilValue,
|
||||
passwordConfirm: passwordConfirmValue,
|
||||
roleList: ["ROLE_PARENT"]
|
||||
};
|
||||
|
|
|
@ -1 +1,26 @@
|
|||
<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']
|
||||
})
|
||||
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']);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,78 +2,129 @@
|
|||
<div class="signup-form text-center">
|
||||
<main class="form-signup">
|
||||
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
|
||||
<h1>Incrivez-vous !</h1>
|
||||
<h1>Inscrivez-vous !</h1>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputlastName"
|
||||
placeholder=""
|
||||
name="lastName"
|
||||
formControlName="lastNameFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['lastNameFc'].touched && signupForm.controls['lastNameFc'].valid,
|
||||
'is-invalid': signupForm.controls['lastNameFc'].touched && !signupForm.controls['lastNameFc'].valid}">
|
||||
[ngClass]="{
|
||||
'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>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="text"
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
id="floatingInputfirstName"
|
||||
placeholder=""
|
||||
name="firstName"
|
||||
formControlName="firstNameFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['firstNameFc'].touched && signupForm.controls['firstNameFc'].valid,
|
||||
'is-invalid': signupForm.controls['firstNameFc'].touched && !signupForm.controls['firstNameFc'].valid}">
|
||||
[ngClass]="{
|
||||
'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>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="date"
|
||||
<input
|
||||
type="date"
|
||||
class="form-control"
|
||||
id="floatingInputdateNaissance"
|
||||
placeholder=""
|
||||
name="dateNaissance"
|
||||
formControlName="dateNaissanceFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['dateNaissanceFc'].touched && signupForm.controls['dateNaissanceFc'].valid,
|
||||
'is-invalid': signupForm.controls['dateNaissanceFc'].touched && !signupForm.controls['dateNaissanceFc'].valid}">
|
||||
[ngClass]="{
|
||||
'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>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="email"
|
||||
<input
|
||||
type="email"
|
||||
class="form-control"
|
||||
id="floatingInput"
|
||||
placeholder=""
|
||||
name="email"
|
||||
formControlName="emailFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['emailFc'].touched && signupForm.controls['emailFc'].valid,
|
||||
'is-invalid': signupForm.controls['emailFc'].touched && !signupForm.controls['emailFc'].valid}">
|
||||
[ngClass]="{
|
||||
'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>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="password"
|
||||
<input
|
||||
type="password"
|
||||
class="form-control"
|
||||
id="floatingPassword"
|
||||
placeholder=""
|
||||
name="password"
|
||||
formControlName="passwordFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['passwordFc'].touched && signupForm.controls['passwordFc'].valid,
|
||||
'is-invalid': signupForm.controls['passwordFc'].touched && !signupForm.controls['passwordFc'].valid}">
|
||||
[ngClass]="{
|
||||
'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>
|
||||
</div>
|
||||
<div class="form-floating">
|
||||
<input type="passwordConfirm"
|
||||
<input
|
||||
type="passwordConfirm"
|
||||
class="form-control"
|
||||
id="floatingpasswordConfirm"
|
||||
placeholder=""
|
||||
name="passwordConfirm"
|
||||
formControlName="passwordConfirmFc"
|
||||
[ngClass]="{'is-valid' : signupForm.controls['passwordConfirmFc'].touched && signupForm.controls['passwordConfirmFc'].valid,
|
||||
'is-invalid': signupForm.controls['passwordConfirmFc'].touched && !signupForm.controls['passwordConfirmFc'].valid}">
|
||||
[ngClass]="{
|
||||
'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>
|
||||
</div>
|
||||
|
||||
<button class="w-100 btn btn-lg btn-success"
|
||||
<button
|
||||
class="w-100 btn btn-lg btn-success"
|
||||
type="submit"
|
||||
[disabled]="signupForm.invalid">Je m'inscris !</button>
|
||||
|
||||
[disabled]="signupForm.invalid"
|
||||
>
|
||||
Je m'inscris !
|
||||
</button>
|
||||
</form>
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
@ -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 !== '') {
|
||||
|
|
|
@ -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';
|
||||
|
@ -54,6 +55,11 @@ export class AuthService {
|
|||
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);
|
||||
}
|
||||
|
||||
creationTeam(team: Team): Observable<any> {
|
||||
console.log(team);
|
||||
|
|
Loading…
Reference in New Issue