aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php')
-rw-r--r--src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
index aed805c9..4eea444f 100644
--- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
+++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
@@ -4,6 +4,7 @@ namespace Wallabag\UserBundle\Mailer;
4 4
5use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; 5use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface;
6use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; 6use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
7use Twig\Environment;
7 8
8/** 9/**
9 * Custom mailer for TwoFactorBundle email. 10 * Custom mailer for TwoFactorBundle email.
@@ -21,7 +22,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface
21 /** 22 /**
22 * Twig to render the html's email. 23 * Twig to render the html's email.
23 * 24 *
24 * @var \Twig_Environment 25 * @var Environment
25 */ 26 */
26 private $twig; 27 private $twig;
27 28
@@ -56,14 +57,12 @@ class AuthCodeMailer implements AuthCodeMailerInterface
56 /** 57 /**
57 * Initialize the auth code mailer with the SwiftMailer object. 58 * Initialize the auth code mailer with the SwiftMailer object.
58 * 59 *
59 * @param \Swift_Mailer $mailer 60 * @param string $senderEmail
60 * @param \Twig_Environment $twig 61 * @param string $senderName
61 * @param string $senderEmail 62 * @param string $supportUrl wallabag support url
62 * @param string $senderName 63 * @param string $wallabagUrl wallabag instance url
63 * @param string $supportUrl wallabag support url
64 * @param string $wallabagUrl wallabag instance url
65 */ 64 */
66 public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) 65 public function __construct(\Swift_Mailer $mailer, Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl)
67 { 66 {
68 $this->mailer = $mailer; 67 $this->mailer = $mailer;
69 $this->twig = $twig; 68 $this->twig = $twig;
@@ -75,10 +74,8 @@ class AuthCodeMailer implements AuthCodeMailerInterface
75 74
76 /** 75 /**
77 * Send the auth code to the user via email. 76 * Send the auth code to the user via email.
78 *
79 * @param TwoFactorInterface $user
80 */ 77 */
81 public function sendAuthCode(TwoFactorInterface $user) 78 public function sendAuthCode(TwoFactorInterface $user): void
82 { 79 {
83 $template = $this->twig->loadTemplate('WallabagUserBundle:TwoFactor:email_auth_code.html.twig'); 80 $template = $this->twig->loadTemplate('WallabagUserBundle:TwoFactor:email_auth_code.html.twig');
84 81
@@ -97,7 +94,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface
97 94
98 $message = new \Swift_Message(); 95 $message = new \Swift_Message();
99 $message 96 $message
100 ->setTo($user->getEmail()) 97 ->setTo($user->getEmailAuthRecipient())
101 ->setFrom($this->senderEmail, $this->senderName) 98 ->setFrom($this->senderEmail, $this->senderName)
102 ->setSubject($subject) 99 ->setSubject($subject)
103 ->setBody($bodyText, 'text/plain') 100 ->setBody($bodyText, 'text/plain')