Merge pull request #102 from AlineRinquin/forgot-reset-password
refacto message alert envoi de mail + tiitre form reset password
This commit is contained in:
commit
06feb4ab79
4 changed files with 26 additions and 14 deletions
|
@ -17,6 +17,11 @@
|
||||||
type="submit"
|
type="submit"
|
||||||
[disabled]="forgotForm.invalid">
|
[disabled]="forgotForm.invalid">
|
||||||
Ré-initialiser mon mot de passe
|
Ré-initialiser mon mot de passe
|
||||||
|
<div class="text-center" *ngIf="isLoading">
|
||||||
|
<div class="spinner-border" role="status">
|
||||||
|
<span class="sr-only">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<br/> <br/>
|
<br/> <br/>
|
||||||
|
@ -25,11 +30,6 @@
|
||||||
{{alert.content}}
|
{{alert.content}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
|
||||||
<div *ngIf="errorForm">
|
|
||||||
<p class="text-danger">Il manque des informations dans le formulaire...</p>
|
|
||||||
</div> -->
|
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,12 @@ export class PageForgotPasswordComponent implements OnInit {
|
||||||
|
|
||||||
alert : any;
|
alert : any;
|
||||||
isShow : boolean;
|
isShow : boolean;
|
||||||
|
isLoading : boolean;
|
||||||
|
|
||||||
constructor(private authService: AuthService, private router: Router, private mailService: MailService,) {
|
constructor(private authService: AuthService, private router: Router, private mailService: MailService,) {
|
||||||
this.alert = "";
|
this.alert = "";
|
||||||
this.isShow = false;
|
this.isShow = false;
|
||||||
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {}
|
ngOnInit(): void {}
|
||||||
|
@ -36,26 +38,36 @@ export class PageForgotPasswordComponent implements OnInit {
|
||||||
passwordConfirm: ""
|
passwordConfirm: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(membre);
|
//console.log(membre);
|
||||||
|
|
||||||
|
|
||||||
this.authService.forgotPassword(membre).subscribe(
|
this.authService.forgotPassword(membre).subscribe(
|
||||||
{
|
{
|
||||||
next: result => {
|
next: result => {
|
||||||
this.alert={"type":"success", "content":"Un mail à été envoyé !"};
|
|
||||||
this.isShow = true;
|
|
||||||
const mail: Mail = {
|
const mail: Mail = {
|
||||||
recipient: submittedForm.form.value.email,
|
recipient: submittedForm.form.value.email,
|
||||||
subject: "Votre mot de passe Organizee",
|
subject: "Votre mot de passe Organizee",
|
||||||
//message: 'Votre mot de passe'
|
|
||||||
message: `
|
message: `
|
||||||
Bonjour!\n
|
Bonjour!\n
|
||||||
Vous avez fait une demande de ré-initialisation de mot de passe. \n
|
Vous avez fait une demande de ré-initialisation de mot de passe. \n
|
||||||
Cliquez sur le lien pour définir un nouveau mot de passe: \n
|
Cliquez sur le lien pour définir un nouveau mot de passe: \n
|
||||||
Lien : http://192.168.1.16:4200/reinitialisation-password/${result}`
|
Lien : http://192.168.1.16:4200/reinitialisation-password/${result}`
|
||||||
};
|
};
|
||||||
this.mailService.envoiMailText(mail)?.subscribe((respMail) =>{
|
this.isLoading = true;
|
||||||
console.log("Mail envoyé");
|
this.mailService.envoiMailText(mail).subscribe(
|
||||||
|
{
|
||||||
|
next: respMail => {
|
||||||
|
//console.log("Mail envoyé");
|
||||||
|
this.alert={"type":"success", "content":"Le mail à été envoyé !"};
|
||||||
|
this.isShow = true;
|
||||||
|
this.isLoading = false;
|
||||||
|
},
|
||||||
|
error: err => {
|
||||||
|
this.alert={"type":"danger", "content":"Echec lors de l'envoi de mail"};
|
||||||
|
this.isShow = true;
|
||||||
|
this.isLoading = false;
|
||||||
|
},
|
||||||
|
complete: () => console.log('DONE!')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
error: err => {
|
error: err => {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="reset-form text-center">
|
<div class="reset-form text-center">
|
||||||
<main class="form-reset">
|
<main class="form-reset">
|
||||||
<form (ngSubmit)="onSubmit()" [formGroup]="resetForm">
|
<form (ngSubmit)="onSubmit()" [formGroup]="resetForm">
|
||||||
<h3>Entrez ici votre email et votre nouveau mot de passe</h3>
|
<h3>Entrez ici votre nouveau mot de passe</h3>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class MailService {
|
||||||
this.tokenKey = environment.tokenKey;
|
this.tokenKey = environment.tokenKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
envoiMailText(mail: Mail): Observable<any> | void{
|
envoiMailText(mail: Mail): Observable<any>{
|
||||||
return this.http.post(`${this.apiUrl}/sendmail/text`, mail, {
|
return this.http.post(`${this.apiUrl}/sendmail/text`, mail, {
|
||||||
responseType: "text"
|
responseType: "text"
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue