reset-password terminé

This commit is contained in:
Blandine Bajard 2022-01-23 09:18:57 +01:00
parent ef3418b45c
commit 7102d73f89
11 changed files with 83 additions and 40 deletions

View file

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

View file

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

View file

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