Merge pull request #9 from AlineRinquin/blandine

Blandine
This commit is contained in:
AlineRinquin 2022-01-21 14:58:50 +01:00 committed by GitHub
commit 0550e1b239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 176 additions and 99 deletions

2
file Normal file
View File

@ -0,0 +1,2 @@
truc

View File

@ -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 },

View File

@ -4,9 +4,6 @@ export interface Membre {
email: string;
password: string;
dateNaissance: Date;
profil: boolean;
roleList: string[];
passwordConfirm: string;
roleList: string[];
}

View File

@ -67,7 +67,6 @@ export class PageAddMemberComponent implements OnInit {
email: emailValue,
password: passwordValue,
dateNaissance: dateNaissanceValue,
profil: profilValue,
passwordConfirm: passwordConfirmValue,
roleList: ["ROLE_PARENT"]
};

View File

@ -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>

View File

@ -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']);
});
}
}

View File

@ -1,79 +1,130 @@
<app-header></app-header>
<div class="signup-form text-center">
<main class="form-signup">
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
<h1>Incrivez-vous !</h1>
<div class="form-floating">
<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}">
<label for="floatingInputlastName">Nom</label>
</div>
<div class="form-floating">
<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}">
<label for="floatingInputfirstName">Prénom</label>
</div>
<div class="form-floating">
<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}">
<label for="floatingInputfirstName">Date de naissance</label>
</div>
<div class="form-floating">
<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}">
<label for="floatingInput">Adresse email</label>
</div>
<div class="form-floating">
<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}">
<label for="floatingPassword">Mot de passe</label>
</div>
<div class="form-floating">
<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}">
<label for="floatingPassword">Confirmer mot de passe</label>
</div>
<main class="form-signup">
<form (ngSubmit)="onSubmit()" [formGroup]="signupForm">
<h1>Inscrivez-vous !</h1>
<div class="form-floating">
<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
}"
/>
<label for="floatingInputlastName">Nom</label>
</div>
<div class="form-floating">
<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
}"
/>
<label for="floatingInputfirstName">Prénom</label>
</div>
<div class="form-floating">
<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
}"
/>
<label for="floatingInputfirstName">Date de naissance</label>
</div>
<div class="form-floating">
<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
}"
/>
<label for="floatingInput">Adresse email</label>
</div>
<div class="form-floating">
<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
}"
/>
<label for="floatingPassword">Mot de passe</label>
</div>
<div class="form-floating">
<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
}"
/>
<label for="floatingPassword">Confirmer mot de passe</label>
</div>
<button class="w-100 btn btn-lg btn-success"
type="submit"
[disabled]="signupForm.invalid">Je m'inscris !</button>
</form>
</main>
<button
class="w-100 btn btn-lg btn-success"
type="submit"
[disabled]="signupForm.invalid"
>
Je m'inscris !
</button>
</form>
</main>
</div>

View File

@ -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 !== '') {

View File

@ -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);