addMember envoi de mail ok
This commit is contained in:
parent
1d96834459
commit
21e076b1ee
4 changed files with 65 additions and 0 deletions
|
|
@ -1,8 +1,10 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { Router } from '@angular/router';
|
||||
import { Mail } from 'src/app/models/mail';
|
||||
import { Membre } from 'src/app/models/membre';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { MailService } from 'src/app/services/mail.service';
|
||||
import { MembreService } from 'src/app/services/membre.service';
|
||||
|
||||
@Component({
|
||||
|
|
@ -15,6 +17,7 @@ export class PageAddMemberComponent implements OnInit {
|
|||
public addMemberForm: FormGroup;
|
||||
constructor(
|
||||
private membreService: MembreService,
|
||||
private mailService: MailService,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private fb: FormBuilder
|
||||
|
|
@ -75,9 +78,21 @@ export class PageAddMemberComponent implements OnInit {
|
|||
roleList: [roleValue]
|
||||
};
|
||||
|
||||
const mail: Mail = {
|
||||
recipient: emailValue,
|
||||
subject: "Votre mot de passe Organizee",
|
||||
//message: 'Votre mot de passe'
|
||||
message: `Bonjour ${firstNameValue}!\n Voici vos identifiants de connexion : \n
|
||||
Identifiant : ${emailValue}
|
||||
Mot de passe : ${passwordValue}`
|
||||
};
|
||||
|
||||
|
||||
if (membre.email !== '' && membre.password !== '') {
|
||||
this.membreService.addMembre(membre)?.subscribe((resp) => {
|
||||
this.mailService.envoiMailText(mail)?.subscribe((respMail) =>{
|
||||
console.log("Mail envoyé");
|
||||
})
|
||||
this.router.navigate(['compte']);
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue