diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2016-01-21 12:27:47 +0100 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2016-01-21 12:27:47 +0100 |
commit | 9aa66d6244935fe86a5598fbdbe518cf6204af2e (patch) | |
tree | a616f79e642b9683b3c7b597ed9c4072c0af5cdf /src/Wallabag/UserBundle/Resources | |
parent | e72a943ad244f8b6349e31eb9a148808045b224b (diff) | |
parent | abd454c45633e335d9d63bcd250e760b968f8138 (diff) | |
download | wallabag-9aa66d6244935fe86a5598fbdbe518cf6204af2e.tar.gz wallabag-9aa66d6244935fe86a5598fbdbe518cf6204af2e.tar.zst wallabag-9aa66d6244935fe86a5598fbdbe518cf6204af2e.zip |
Merge pull request #1565 from wallabag/v2-2fa-html
Use HTML email for 2FA
Diffstat (limited to 'src/Wallabag/UserBundle/Resources')
4 files changed, 129 insertions, 17 deletions
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index 9109b6a3..93e04d59 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml | |||
@@ -3,7 +3,8 @@ services: | |||
3 | class: Wallabag\UserBundle\Mailer\AuthCodeMailer | 3 | class: Wallabag\UserBundle\Mailer\AuthCodeMailer |
4 | arguments: | 4 | arguments: |
5 | - "@mailer" | 5 | - "@mailer" |
6 | - "@translator" | 6 | - "@twig" |
7 | - "%scheb_two_factor.email.sender_email%" | 7 | - "%scheb_two_factor.email.sender_email%" |
8 | - "%scheb_two_factor.email.sender_name%" | 8 | - "%scheb_two_factor.email.sender_name%" |
9 | - "%wallabag_support_url%" | 9 | - "%wallabag_support_url%" |
10 | - "%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 f806d1d6..4da6075f 100644 --- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml +++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml | |||
@@ -1,10 +1,7 @@ | |||
1 | # Two factor mail | 1 | # Two factor mail |
2 | auth_code.mailer.subject: 'Wallabag authentication Code' | 2 | auth_code.mailer.subject: 'Wallabag authentication Code' |
3 | auth_code.mailer.body: | | 3 | auth_code.mailer.body.hello: "Hi %user%," |
4 | Hi %user%, | 4 | 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." |
5 | 5 | auth_code.mailer.body.second_para: "Here is the code:" | |
6 | 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. | 6 | auth_code.mailer.body.support: "Please don't hesitate to contact us if you have any problems:" |
7 | Here is the code: %code% | 7 | auth_code.mailer.body.signature: "The wallabag team" |
8 | |||
9 | Please don't hesitate to contact us if you have any problems: %support% | ||
10 | 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 386b2d9e..b4448d3a 100644 --- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml +++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.fr.yml | |||
@@ -1,10 +1,7 @@ | |||
1 | # Two factor mail | 1 | # Two factor mail |
2 | auth_code.mailer.subject: "Code d'authentification wallabag" | 2 | auth_code.mailer.subject: "Code d'authentification wallabag" |
3 | auth_code.mailer.body: | | 3 | auth_code.mailer.body.hello: "Bonjour %user%," |
4 | Bonjour %user%, | 4 | 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." |
5 | 5 | auth_code.mailer.body.second_para: "Voici le code à renseigner :" | |
6 | 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. | 6 | auth_code.mailer.body.support: "Si vous avez un problème de connexion, n'hésitez pas à contacter le support :" |
7 | Voici le code à renseigner: %code% | 7 | auth_code.mailer.body.signature: "L'équipe wallabag" |
8 | |||
9 | Si vous avez un problème de connexion, n'hésitez pas à contacter le support: %support% | ||
10 | 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 new file mode 100644 index 00000000..69d23160 --- /dev/null +++ b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig | |||
@@ -0,0 +1,117 @@ | |||
1 | {% block subject %} | ||
2 | {{ "auth_code.mailer.subject"|trans({}, 'wallabag_user') }} | ||
3 | {% endblock %} | ||
4 | |||
5 | {% block body_text %} | ||
6 | {{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }} | ||
7 | |||
8 | {{ "auth_code.mailer.body.first_para"|trans({}, 'wallabag_user') }} | ||
9 | {{ "auth_code.mailer.body.second_para"|trans({}, 'wallabag_user') }} {{ code }} | ||
10 | |||
11 | {{ "auth_code.mailer.body.support"|trans({}, 'wallabag_user') }} {{ support_url }} | ||
12 | |||
13 | {{ "auth_code.mailer.body.signature"|trans({}, 'wallabag_user') }} | ||
14 | {% endblock %} | ||
15 | |||
16 | {% block body_html %} | ||
17 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
18 | |||
19 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
20 | <head> | ||
21 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
22 | <meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
23 | <title>{{ "auth_code.mailer.subject"|trans({}, 'wallabag_user') }}</title> | ||
24 | <style type="text/css"> | ||
25 | #outlook a {padding:0;} | ||
26 | body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0; font-family: Helvetica, Arial, sans-serif; background: #c6d4e0;} | ||
27 | .ExternalClass {width:100%;} | ||
28 | .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} | ||
29 | #backgroundTable {margin:0; padding:0; width:100% !important; line-height: 100% !important; background: #c6d4e0;} | ||
30 | img {outline:none; text-decoration:none; -ms-interpolation-mode: bicubic;} | ||
31 | a img {border:none;} | ||
32 | .image_fix {display:block;} | ||
33 | p {margin: 1em 0;} | ||
34 | h1, h2, h3, h4, h5, h6 {color: black !important;} | ||
35 | h1 a, h2 a, h3 a, h4 a, h5 a, h6 a {color: blue !important;} | ||
36 | h1 a:active, h2 a:active, h3 a:active, h4 a:active, h5 a:active, h6 a:active { | ||
37 | color: red !important; | ||
38 | } | ||
39 | h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited { | ||
40 | color: purple !important; | ||
41 | } | ||
42 | table td {border-collapse: collapse;} | ||
43 | table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; } | ||
44 | a {color: #373737;} | ||
45 | |||
46 | #card { | ||
47 | background: #ffffff; | ||
48 | border: 1px solid #c5c5c5; | ||
49 | width: 89%; | ||
50 | margin: 5%; | ||
51 | } | ||
52 | #cell_desc h1, h5 { | ||
53 | display: block; | ||
54 | margin: 0; | ||
55 | } | ||
56 | #cell_desc h1 { | ||
57 | line-height: 35px; | ||
58 | margin-bottom: 10px; | ||
59 | } | ||
60 | #bg {background: #f2f2f2} | ||
61 | |||
62 | </style> | ||
63 | </head> | ||
64 | <body> | ||
65 | |||
66 | <!-- hidden text for preview --> | ||
67 | <div style="display:none;font-size:1px;color:#333333;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;"> | ||
68 | {{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }} | ||
69 | </div> | ||
70 | |||
71 | <table cellpadding="0" cellspacing="0" border="0" id="backgroundTable"> | ||
72 | <tr> | ||
73 | <td> | ||
74 | |||
75 | <table cellpadding="0" cellspacing="0" border="0" align="center" id="card"> | ||
76 | <tr> | ||
77 | <td style="padding: 20px;" width="96px" valign="top"><img class="image_fix" src="{{ wallabag_url }}/themes/material/img/logo-other_themes.png" alt="logo" title="{{ wallabag_url }}" style="width: 96px; height: 96px;" /></td> | ||
78 | <td style="padding: 20px; padding-left: 0;" valign="top" id="cell_desc"> | ||
79 | <h1>wallabag</h1> | ||
80 | <h5>{% trans %}on{% endtrans %} {{ wallabag_url }}</h5> | ||
81 | </td> | ||
82 | </tr> | ||
83 | <tr><td colspan="2" style="padding: 0;"><div style="height: 0; border-top: 1px solid #c5c5c5;"> </div></td></tr> | ||
84 | <tr id="bg"> | ||
85 | <td style="padding: 20px;" colspan="2" valign="top"> | ||
86 | |||
87 | <p><b>{{ "auth_code.mailer.body.hello"|trans({'%user%': user}, 'wallabag_user') }}</b></p> | ||
88 | |||
89 | <p>{{ "auth_code.mailer.body.first_para"|trans({}, 'wallabag_user') }}</p> | ||
90 | <p>{{ "auth_code.mailer.body.second_para"|trans({}, 'wallabag_user') }} <b>{{ code }}</b></p> | ||
91 | |||
92 | <p>{{ "auth_code.mailer.body.support"|trans({}, 'wallabag_user') }} <a href="{{ support_url }}">{{ support_url }}</a></p> | ||
93 | <p>{{ "auth_code.mailer.body.signature"|trans({}, 'wallabag_user') }}</p> | ||
94 | </td> | ||
95 | </tr> | ||
96 | <tr><td colspan="2" style="padding: 0;"><div style="height: 0; border-top: 1px solid #c5c5c5;"> </div></td></tr> | ||
97 | <tr> | ||
98 | <td colspan="2"> | ||
99 | |||
100 | <table cellpadding="0" cellspacing="0" border="0" width="100%"> | ||
101 | <tr> | ||
102 | <td valign="top" style="padding: 20px; text-align: center"><a href="{{ wallabag_url }}">{{ wallabag_url }}</a></td> | ||
103 | <td valign="top" style="padding: 20px; text-align: center">Powered by <a href="https://www.wallabag.org/">wallabag</a></td> | ||
104 | </tr> | ||
105 | </table> | ||
106 | |||
107 | </td> | ||
108 | </tr> | ||
109 | </table> | ||
110 | |||
111 | </td> | ||
112 | </tr> | ||
113 | </table> | ||
114 | |||
115 | </body> | ||
116 | </html> | ||
117 | {% endblock %} | ||