diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml
index 6b077fdbd..2813e369d 100644
--- a/app/config/config_dev.yml
+++ b/app/config/config_dev.yml
@@ -42,6 +42,3 @@ swiftmailer:
transport: smtp
host: 'localhost'
port: 1025
- username: null
- password: null
-
diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
index fa682ae75..6b108dd3e 100644
--- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
+++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
@@ -46,6 +46,13 @@ class AuthCodeMailer implements AuthCodeMailerInterface
*/
private $supportUrl;
+ /**
+ * Url for the wallabag instance.
+ *
+ * @var string
+ */
+ private $wallabagUrl;
+
/**
* Initialize the auth code mailer with the SwiftMailer object.
*
@@ -54,14 +61,16 @@ class AuthCodeMailer implements AuthCodeMailerInterface
* @param string $senderEmail
* @param string $senderName
* @param string $supportUrl
+ * @param string $wallabagUrl
*/
- 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;
}
/**
@@ -77,12 +86,13 @@ class AuthCodeMailer implements AuthCodeMailerInterface
$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();
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml
index aa2fd8b98..93e04d592 100644
--- a/src/Wallabag/UserBundle/Resources/config/services.yml
+++ b/src/Wallabag/UserBundle/Resources/config/services.yml
@@ -7,3 +7,4 @@ services:
- "%scheb_two_factor.email.sender_email%"
- "%scheb_two_factor.email.sender_name%"
- "%wallabag_support_url%"
+ - "%wallabag_url%"
diff --git a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml
index 7298bb28b..4da6075f4 100644
--- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml
+++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml
@@ -1,9 +1,7 @@
# Two factor mail
auth_code.mailer.subject: 'Wallabag authentication Code'
auth_code.mailer.body.hello: "Hi %user%,"
-auth_code.mailer.body.content: |
- Since you enable two factor authentication on your wallabag account and you just logged in from a new device (computer, phone, etc.), we send you a code to validate your connection.
- Here is the code: %code%
-auth_code.mailer.body.signature: |
- Please don't hesitate to contact us if you have any problems: %support%
- The wallabag team
+auth_code.mailer.body.first_para: "Since you enable two factor authentication on your wallabag account and you just logged in from a new device (computer, phone, etc.), we send you a code to validate your connection."
+auth_code.mailer.body.second_para: "Here is the code:"
+auth_code.mailer.body.support: "Please don't hesitate to contact us if you have any problems:"
+auth_code.mailer.body.signature: "The wallabag team"
diff --git a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml
index 0c492d044..b4448d3a4 100644
--- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml
+++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml
@@ -1,9 +1,7 @@
# Two factor mail
auth_code.mailer.subject: "Code d'authentification wallabag"
auth_code.mailer.body.hello: "Bonjour %user%,"
-auth_code.mailer.body.content: |
- Comme vous avez activé la double authentification sur votre compte wallabag et que vous venez de vous connecter depuis un nouvel appareil (ordinateur, téléphone, etc.), nous vous envoyons un code pour valider votre connexion.
- Voici le code à renseigner: %code%
-auth_code.mailer.body.signature: |
- Si vous avez un problème de connexion, n'hésitez pas à contacter le support: %support%
- L'équipe wallabag
+auth_code.mailer.body.first_para: "Comme vous avez activé la double authentification sur votre compte wallabag et que vous venez de vous connecter depuis un nouvel appareil (ordinateur, téléphone, etc.), nous vous envoyons un code pour valider votre connexion."
+auth_code.mailer.body.second_para: "Voici le code à renseigner :"
+auth_code.mailer.body.support: "Si vous avez un problème de connexion, n'hésitez pas à contacter le support :"
+auth_code.mailer.body.signature: "L'équipe wallabag"
diff --git a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig
index 849cd1364..69d231600 100644
--- a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig
+++ b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig
@@ -2,6 +2,17 @@
{{ "auth_code.mailer.subject"|trans({}, 'wallabag_user') }}
{% endblock %}
+{% block body_text %}
+{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }}
+
+{{ "auth_code.mailer.body.first_para"|trans({}, 'wallabag_user') }}
+{{ "auth_code.mailer.body.second_para"|trans({}, 'wallabag_user') }} {{ code }}
+
+{{ "auth_code.mailer.body.support"|trans({}, 'wallabag_user') }} {{ support_url }}
+
+{{ "auth_code.mailer.body.signature"|trans({}, 'wallabag_user') }}
+{% endblock %}
+
{% block body_html %}
@@ -63,10 +74,10 @@
-  |
+  |
- Wallabag
- {% trans %}on{% endtrans %} { wallabag_url }
+ wallabag
+ {% trans %}on{% endtrans %} {{ wallabag_url }}
|
|
@@ -75,10 +86,11 @@
{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }}
- {{ "auth_code.mailer.body.content"|trans({'%code%': code}, 'wallabag_user') }}
-
- {{ "auth_code.mailer.body.signature"|trans({'%support%': support}, 'wallabag_user') }}
+ {{ "auth_code.mailer.body.first_para"|trans({}, 'wallabag_user') }}
+ {{ "auth_code.mailer.body.second_para"|trans({}, 'wallabag_user') }} {{ code }}
+ {{ "auth_code.mailer.body.support"|trans({}, 'wallabag_user') }} {{ support_url }}
+ {{ "auth_code.mailer.body.signature"|trans({}, 'wallabag_user') }}
|
@@ -87,8 +99,8 @@
@@ -103,10 +115,3 @@