]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
Merge pull request #2521 from foxmask/master
[github/wallabag/wallabag.git] / src / Wallabag / UserBundle / Mailer / AuthCodeMailer.php
index fa682ae75025d6ee18fafbf379fab5cf79e01db1..961208f27d2ff1340c93806d77a8a83a149c62af 100644 (file)
@@ -46,6 +46,13 @@ class AuthCodeMailer implements AuthCodeMailerInterface
      */
     private $supportUrl;
 
+    /**
+     * Url for the wallabag instance (only used for image in the HTML email template).
+     *
+     * @var string
+     */
+    private $wallabagUrl;
+
     /**
      * Initialize the auth code mailer with the SwiftMailer object.
      *
@@ -53,15 +60,17 @@ class AuthCodeMailer implements AuthCodeMailerInterface
      * @param \Twig_Environment $twig
      * @param string            $senderEmail
      * @param string            $senderName
-     * @param string            $supportUrl
+     * @param string            $supportUrl  wallabag support url
+     * @param string            $wallabagUrl wallabag instance url
      */
-    public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl)
+    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 = $supportUrl;
+        $this->wallabagUrl = $wallabagUrl;
     }
 
     /**
@@ -71,18 +80,19 @@ class AuthCodeMailer implements AuthCodeMailerInterface
      */
     public function sendAuthCode(TwoFactorInterface $user)
     {
-        $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(),
-            'support' => $this->supportUrl,
+            'support_url' => $this->supportUrl,
+            'wallabag_url' => $this->wallabagUrl,
         ]);
         $bodyText = $template->renderBlock('body_text', [
             'user' => $user->getName(),
             'code' => $user->getEmailAuthCode(),
-            'support' => $this->supportUrl,
+            'support_url' => $this->supportUrl,
         ]);
 
         $message = new \Swift_Message();