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.
* @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;
}
/**
*
* @param TwoFactorInterface $user
*/
- public function sendAuthCode(TwoFactorInterface $user)
+ public function sendAuthCode(TwoFactorInterface $user): void
{
$template = $this->twig->loadTemplate('WallabagUserBundle:TwoFactor:email_auth_code.html.twig');
$message = new \Swift_Message();
$message
- ->setTo($user->getEmail())
+ ->setTo($user->getEmailAuthRecipient())
->setFrom($this->senderEmail, $this->senderName)
->setSubject($subject)
->setBody($bodyText, 'text/plain')