|
@@ -44,12 +44,17 @@ class Mail
|
|
|
$this->mailer->send($mail);
|
|
|
}
|
|
|
|
|
|
+ protected function setBody(string $template, User $user, string $lien): string
|
|
|
+ {
|
|
|
+ return $this->templating->render($template, ['user' => $user, 'lien' => $lien]);
|
|
|
+ }
|
|
|
+
|
|
|
public function sendMailActivation(User $user, string $lien): void
|
|
|
{
|
|
|
$subject = "Activation de votre compte";
|
|
|
$template = 'security/mail_activate.html.twig';
|
|
|
$to = $user->getMail();
|
|
|
- $body = $this->templating->render($template, ['user' => $user, 'lien' => $lien]);
|
|
|
+ $body = $this->setBody($template, $user, $lien);
|
|
|
$this->sendMessage($subject, $to, $body);
|
|
|
}
|
|
|
|
|
@@ -58,7 +63,7 @@ class Mail
|
|
|
$subject = "Demande d'activation";
|
|
|
$template = 'security/mail_demande_activation.html.twig';
|
|
|
$to = $this->from;
|
|
|
- $body = $this->templating->render($template, ['user' => $user, 'lien' => $lien]);
|
|
|
+ $body = $this->setBody($template, $user, $lien);
|
|
|
$this->sendMessage($subject, $to, $body);
|
|
|
}
|
|
|
|
|
@@ -67,7 +72,7 @@ class Mail
|
|
|
$subject = "Mot de passe perdu";
|
|
|
$template = 'security/mail_tokenmdp.html.twig';
|
|
|
$to = $user->getMail();
|
|
|
- $body = $this->templating->render($template, ['user' => $user, 'lien' => $lien]);
|
|
|
+ $body = $this->setBody($template, $user, $lien);
|
|
|
$this->sendMessage($subject, $to, $body);
|
|
|
}
|
|
|
}
|