aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/UserBundle')
-rw-r--r--src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php12
-rw-r--r--src/Wallabag/UserBundle/Resources/config/services.yml3
-rw-r--r--src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php12
3 files changed, 17 insertions, 10 deletions
diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
index 6b108dd3..98017f43 100644
--- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
+++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
@@ -4,6 +4,7 @@ namespace Wallabag\UserBundle\Mailer;
4 4
5use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; 5use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
6use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; 6use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface;
7use Craue\ConfigBundle\Util\Config;
7 8
8/** 9/**
9 * Custom mailer for TwoFactorBundle email. 10 * Custom mailer for TwoFactorBundle email.
@@ -47,7 +48,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface
47 private $supportUrl; 48 private $supportUrl;
48 49
49 /** 50 /**
50 * Url for the wallabag instance. 51 * Url for the wallabag instance (only used for image in the HTML email template)
51 * 52 *
52 * @var string 53 * @var string
53 */ 54 */
@@ -60,17 +61,16 @@ class AuthCodeMailer implements AuthCodeMailerInterface
60 * @param \Twig_Environment $twig 61 * @param \Twig_Environment $twig
61 * @param string $senderEmail 62 * @param string $senderEmail
62 * @param string $senderName 63 * @param string $senderName
63 * @param string $supportUrl 64 * @param Config $craueConfig Craue\Config instance to get wallabag support url from database
64 * @param string $wallabagUrl
65 */ 65 */
66 public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) 66 public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, Config $craueConfig)
67 { 67 {
68 $this->mailer = $mailer; 68 $this->mailer = $mailer;
69 $this->twig = $twig; 69 $this->twig = $twig;
70 $this->senderEmail = $senderEmail; 70 $this->senderEmail = $senderEmail;
71 $this->senderName = $senderName; 71 $this->senderName = $senderName;
72 $this->supportUrl = $supportUrl; 72 $this->supportUrl = $craueConfig->get('wallabag_support_url');
73 $this->wallabagUrl = $wallabagUrl; 73 $this->wallabagUrl = $craueConfig->get('wallabag_url');
74 } 74 }
75 75
76 /** 76 /**
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml
index 8321473a..9a589332 100644
--- a/src/Wallabag/UserBundle/Resources/config/services.yml
+++ b/src/Wallabag/UserBundle/Resources/config/services.yml
@@ -11,8 +11,7 @@ services:
11 - "@twig" 11 - "@twig"
12 - "%scheb_two_factor.email.sender_email%" 12 - "%scheb_two_factor.email.sender_email%"
13 - "%scheb_two_factor.email.sender_name%" 13 - "%scheb_two_factor.email.sender_name%"
14 - "%wallabag_support_url%" 14 - "@craue_config"
15 - "%wallabag_url%"
16 15
17 wallabag_user.password_resetting: 16 wallabag_user.password_resetting:
18 class: Wallabag\UserBundle\EventListener\PasswordResettingListener 17 class: Wallabag\UserBundle\EventListener\PasswordResettingListener
diff --git a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php
index e3f43a7e..562a1ed2 100644
--- a/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php
+++ b/src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php
@@ -26,6 +26,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase
26 protected $mailer; 26 protected $mailer;
27 protected $spool; 27 protected $spool;
28 protected $twig; 28 protected $twig;
29 protected $config;
29 30
30 protected function setUp() 31 protected function setUp()
31 { 32 {
@@ -43,6 +44,14 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase
43TWIG; 44TWIG;
44 45
45 $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => $twigTemplate))); 46 $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => $twigTemplate)));
47
48 $this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
49 ->disableOriginalConstructor()
50 ->getMock();
51
52 $this->config->expects($this->any())
53 ->method('get')
54 ->willReturn('http://0.0.0.0/support');
46 } 55 }
47 56
48 public function testSendEmail() 57 public function testSendEmail()
@@ -58,8 +67,7 @@ TWIG;
58 $this->twig, 67 $this->twig,
59 'nobody@test.io', 68 'nobody@test.io',
60 'wallabag test', 69 'wallabag test',
61 'http://0.0.0.0/support', 70 $this->config
62 'http://0.0.0.0'
63 ); 71 );
64 72
65 $authCodeMailer->sendAuthCode($user); 73 $authCodeMailer->sendAuthCode($user);