use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface;
-use Symfony\Component\Translation\TranslatorInterface;
+use Craue\ConfigBundle\Util\Config;
/**
* Custom mailer for TwoFactorBundle email.
*/
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.
*
- * @param \Swift_Mailer $mailer
- * @param \Twig_Environment $twig
- * @param string $senderEmail
- * @param string $senderName
- * @param string $supportUrl
+ * @param \Swift_Mailer $mailer
+ * @param \Twig_Environment $twig
+ * @param string $senderEmail
+ * @param string $senderName
+ * @param Config $craueConfig Craue\Config instance to get wallabag support url from database
*/
- public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl)
+ public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, Config $craueConfig)
{
$this->mailer = $mailer;
$this->twig = $twig;
$this->senderEmail = $senderEmail;
$this->senderName = $senderName;
- $this->supportUrl = $supportUrl;
+ $this->supportUrl = $craueConfig->get('wallabag_support_url');
+ $this->wallabagUrl = $craueConfig->get('wallabag_url');
}
/**
{
$template = $this->twig->loadTemplate('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig');
- $subject = $template->renderBlock('subject', array());
+ $subject = $template->renderBlock('subject', array());
$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();