X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FUserBundle%2FMailer%2FAuthCodeMailer.php;h=4eea444f249ed685bbe0cd78ca27dd5e9587315d;hb=48b0163d247554d7e2f1ec63b717c8216ea9ec59;hp=6b108dd3ef2a7605720b3cab8c451e45557c8f88;hpb=9aa66d6244935fe86a5598fbdbe518cf6204af2e;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index 6b108dd3..4eea444f 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php @@ -2,8 +2,9 @@ namespace Wallabag\UserBundle\Mailer; -use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; +use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; +use Twig\Environment; /** * Custom mailer for TwoFactorBundle email. @@ -21,7 +22,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface /** * Twig to render the html's email. * - * @var \Twig_Environment + * @var Environment */ private $twig; @@ -47,7 +48,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface private $supportUrl; /** - * Url for the wallabag instance. + * Url for the wallabag instance (only used for image in the HTML email template). * * @var string */ @@ -56,14 +57,12 @@ class AuthCodeMailer implements AuthCodeMailerInterface /** * Initialize the auth code mailer with the SwiftMailer object. * - * @param \Swift_Mailer $mailer - * @param \Twig_Environment $twig - * @param string $senderEmail - * @param string $senderName - * @param string $supportUrl - * @param string $wallabagUrl + * @param string $senderEmail + * @param string $senderName + * @param string $supportUrl wallabag support url + * @param string $wallabagUrl wallabag instance url */ - public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) + public function __construct(\Swift_Mailer $mailer, Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) { $this->mailer = $mailer; $this->twig = $twig; @@ -75,14 +74,12 @@ class AuthCodeMailer implements AuthCodeMailerInterface /** * Send the auth code to the user via email. - * - * @param TwoFactorInterface $user */ - public function sendAuthCode(TwoFactorInterface $user) + public function sendAuthCode(TwoFactorInterface $user): void { - $template = $this->twig->loadTemplate('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig'); + $template = $this->twig->loadTemplate('WallabagUserBundle:TwoFactor:email_auth_code.html.twig'); - $subject = $template->renderBlock('subject', array()); + $subject = $template->renderBlock('subject', []); $bodyHtml = $template->renderBlock('body_html', [ 'user' => $user->getName(), 'code' => $user->getEmailAuthCode(), @@ -97,7 +94,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface $message = new \Swift_Message(); $message - ->setTo($user->getEmail()) + ->setTo($user->getEmailAuthRecipient()) ->setFrom($this->senderEmail, $this->senderName) ->setSubject($subject) ->setBody($bodyText, 'text/plain')