From 63e40f2d7c4074aff0be587c828eb511a6b7c878 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 21 Jan 2016 08:53:09 +0100 Subject: Add CraueConfig for internal settings --- src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | 10 +++++----- src/Wallabag/UserBundle/Resources/config/services.yml | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/Wallabag/UserBundle') diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index 6b108dd3..4ab6051b 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php @@ -4,6 +4,7 @@ namespace Wallabag\UserBundle\Mailer; use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; +use Craue\ConfigBundle\Util\Config; /** * Custom mailer for TwoFactorBundle email. @@ -60,17 +61,16 @@ class AuthCodeMailer implements AuthCodeMailerInterface * @param \Twig_Environment $twig * @param string $senderEmail * @param string $senderName - * @param string $supportUrl - * @param string $wallabagUrl + * @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, $wallabagUrl) + 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->wallabagUrl = $wallabagUrl; + $this->supportUrl = $craueConfig->get('wallabag_support_url'); + $this->wallabagUrl = $craueConfig->get('wallabag_url'); } /** diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index bf9e036a..d79d8fa2 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml @@ -6,8 +6,7 @@ services: - "@twig" - "%scheb_two_factor.email.sender_email%" - "%scheb_two_factor.email.sender_name%" - - "%wallabag_support_url%" - - "%wallabag_url%" + - "@craue_config" wallabag_user.password_resetting: class: Wallabag\UserBundle\EventListener\PasswordResettingListener -- cgit v1.2.3 From 2a58606983bd6091866a9f38149a87c25900decd Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 21 Jan 2016 12:24:35 +0100 Subject: Fix tests --- src/Wallabag/UserBundle/Tests/Mailer/AuthCodeMailerTest.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/UserBundle') 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 protected $mailer; protected $spool; protected $twig; + protected $config; protected function setUp() { @@ -43,6 +44,14 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase TWIG; $this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('@WallabagUserBundle/Resources/views/TwoFactor/email_auth_code.html.twig' => $twigTemplate))); + + $this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config') + ->disableOriginalConstructor() + ->getMock(); + + $this->config->expects($this->any()) + ->method('get') + ->willReturn('http://0.0.0.0/support'); } public function testSendEmail() @@ -58,8 +67,7 @@ TWIG; $this->twig, 'nobody@test.io', 'wallabag test', - 'http://0.0.0.0/support', - 'http://0.0.0.0' + $this->config ); $authCodeMailer->sendAuthCode($user); -- cgit v1.2.3 From 1c7d66645b312ee41a392c1d154f49fb6a6ec389 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 21 Jan 2016 12:29:35 +0100 Subject: CS --- src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Wallabag/UserBundle') diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index 4ab6051b..98017f43 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php @@ -48,7 +48,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface private $supportUrl; /** - * Url for the wallabag instance. + * Url for the wallabag instance (only used for image in the HTML email template) * * @var string */ -- cgit v1.2.3 From 48e3007b7f5b542ebd8dda07a7a206f3bce69d7a Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 31 Jan 2016 15:12:18 +0100 Subject: Fix from_email & fos_user --- src/Wallabag/UserBundle/Resources/config/services.yml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Wallabag/UserBundle') diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index d79d8fa2..9a589332 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml @@ -1,4 +1,9 @@ services: + # might be fixed in the symfony release + # https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2048 + fos_user.doctrine_registry: + alias: doctrine + wallabag_user.auth_code_mailer: class: Wallabag\UserBundle\Mailer\AuthCodeMailer arguments: -- cgit v1.2.3