X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FUserBundle%2FMailer%2FAuthCodeMailer.php;h=2797efde9edb3aa90c4ea4199c9f1f6a185351a7;hb=3620dae1e6b3fab5a4ba4001b4581ce7ed795996;hp=d078bdf761f5577a2b375dbc258209ce901e98bc;hpb=bc358c918005159afe3f7c350c0c0c29f4054e4c;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index d078bdf7..2797efde 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php @@ -2,9 +2,8 @@ namespace Wallabag\UserBundle\Mailer; -use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; -use Craue\ConfigBundle\Util\Config; +use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; /** * Custom mailer for TwoFactorBundle email. @@ -61,16 +60,17 @@ class AuthCodeMailer implements AuthCodeMailerInterface * @param \Twig_Environment $twig * @param string $senderEmail * @param string $senderName - * @param Config $craueConfig Craue\Config instance to get wallabag support url from database + * @param string $supportUrl wallabag support url + * @param string $wallabagUrl wallabag instance url */ - public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, Config $craueConfig) + public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) { $this->mailer = $mailer; $this->twig = $twig; $this->senderEmail = $senderEmail; $this->senderName = $senderName; - $this->supportUrl = $craueConfig->get('wallabag_support_url'); - $this->wallabagUrl = $craueConfig->get('wallabag_url'); + $this->supportUrl = $supportUrl; + $this->wallabagUrl = $wallabagUrl; } /** @@ -78,11 +78,11 @@ class AuthCodeMailer implements AuthCodeMailerInterface * * @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 +97,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')