Skip to content

Commit 6afaae5

Browse files
committed
Disable automatic hyperlink in email template
1 parent b0c1422 commit 6afaae5

9 files changed

+45
-28
lines changed

Diff for: rdiffweb/core/notification.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def access_token_added(self, userobj, name):
7373

7474
# Send a mail notification
7575
body = self.app.templates.compile_template(
76-
"access_token_added.html", **{"header_name": self.app.cfg.header_name, 'user': userobj, 'name': name}
76+
"email_access_token_added.html", **{"header_name": self.app.cfg.header_name, 'user': userobj, 'name': name}
7777
)
7878
self.bus.publish('queue_mail', to=userobj.email, subject=_("A new access token has been created"), message=body)
7979

@@ -118,7 +118,7 @@ def user_password_changed(self, userobj):
118118

119119
# If the email attributes was changed, send a mail notification.
120120
body = self.app.templates.compile_template(
121-
"password_changed.html", **{"header_name": self.app.cfg.header_name, 'user': userobj}
121+
"email_password_changed.html", **{"header_name": self.app.cfg.header_name, 'user': userobj}
122122
)
123123
self.bus.publish('queue_mail', to=userobj.email, subject=_("Password changed"), message=body)
124124

Diff for: rdiffweb/core/tests/test_notification.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def test_notification_job(self):
6464
self.listener.queue_email.assert_called_once_with(
6565
to='test@test.com',
6666
subject='Notification',
67-
message="<html>\n <head></head>\n <body>\n Hey admin,\n <p>\n You are receiving this email to notify you about your backups. The\n following repositories are inactive for some time. We invite you to have a look\n at your last backup schedule.\n </p>\n <ul>\n <li>testcases</li>\n </ul>\n <p>\n If you don't want to be notify about this. You need to review your\n user preferences.\n </p>\n </body>\n</html>",
67+
message="<html>\n <head></head>\n <body>\n <p>\n <a>Hey admin,</a>\n </p>\n <p>\n You are receiving this email to notify you about your backups. The\n following repositories are inactive for some time. We invite you to have a look\n at your last backup schedule.\n </p>\n <ul>\n \n <li>\n <a>testcases</a>\n </li>\n \n </ul>\n <p>If you don't want to be notify about this. You need to review your user preferences.</p>\n </body>\n</html>",
6868
)
6969

7070
def test_notification_job_undefined_last_backup_date(self):
@@ -85,7 +85,7 @@ def test_notification_job_undefined_last_backup_date(self):
8585
self.listener.queue_email.assert_called_once_with(
8686
to='test@test.com',
8787
subject='Notification',
88-
message="<html>\n <head></head>\n <body>\n Hey admin,\n <p>\n You are receiving this email to notify you about your backups. The\n following repositories are inactive for some time. We invite you to have a look\n at your last backup schedule.\n </p>\n <ul>\n <li>broker-repo</li>\n </ul>\n <p>\n If you don't want to be notify about this. You need to review your\n user preferences.\n </p>\n </body>\n</html>",
88+
message="<html>\n <head></head>\n <body>\n <p>\n <a>Hey admin,</a>\n </p>\n <p>\n You are receiving this email to notify you about your backups. The\n following repositories are inactive for some time. We invite you to have a look\n at your last backup schedule.\n </p>\n <ul>\n \n <li>\n <a>broker-repo</a>\n </li>\n \n </ul>\n <p>If you don't want to be notify about this. You need to review your user preferences.</p>\n </body>\n</html>",
8989
)
9090

9191
def test_notification_job_without_notification(self):
@@ -135,7 +135,7 @@ def test_email_changed(self):
135135
self.listener.queue_email.assert_called_once_with(
136136
to='original_email@test.com',
137137
subject='Email address changed',
138-
message='<html>\n <head></head>\n <body>\n Hey admin,\n <p>You recently changed the email address associated with your Rdiffweb account.</p>\n <p>\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n </p>\n </body>\n</html>',
138+
message='<html>\n <head></head>\n <body>\n <p>\n <a>Hey admin,</a>\n </p>\n <p>\n <a>You recently changed the email address associated with your Rdiffweb account.</a>\n </p>\n <p>\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n </p>\n </body>\n</html>',
139139
)
140140

141141
def test_email_updated_with_same_value(self):
@@ -167,7 +167,7 @@ def test_password_change_notification(self):
167167
self.listener.queue_email.assert_called_once_with(
168168
to='password_change@test.com',
169169
subject='Password changed',
170-
message='<html>\n <head></head>\n <body>\n Hey admin,\n <p>You recently changed the password associated with your Rdiffweb account.</p>\n <p>\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n </p>\n </body>\n</html>',
170+
message='<html>\n <head></head>\n <body>\n <p>\n <a>Hey admin,</a>\n </p>\n <p>You recently changed the password associated with your Rdiffweb account.</p>\n <p>\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n </p>\n </body>\n</html>',
171171
)
172172

173173
def test_password_change_with_same_value(self):
@@ -186,5 +186,5 @@ def test_password_change_with_same_value(self):
186186
self.listener.queue_email.assert_called_once_with(
187187
to='password_change@test.com',
188188
subject='Password changed',
189-
message='<html>\n <head></head>\n <body>\n Hey admin,\n <p>You recently changed the password associated with your Rdiffweb account.</p>\n <p>\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n </p>\n </body>\n</html>',
189+
message='<html>\n <head></head>\n <body>\n <p>\n <a>Hey admin,</a>\n </p>\n <p>You recently changed the password associated with your Rdiffweb account.</p>\n <p>\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n </p>\n </body>\n</html>',
190190
)

Diff for: rdiffweb/templates/access_token_added.html

-10
This file was deleted.

Diff for: rdiffweb/templates/email_access_token_added.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<head></head>
3+
<body>
4+
<p>
5+
<a>{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}</a>
6+
</p>
7+
<p>
8+
<a>{% trans %}A new access token, named "{{ name }}", has been created.{% endtrans %}</a>
9+
</p>
10+
<p>
11+
{% trans %}If you did not make this change and believe your account has been compromised, please contact your administrator.{% endtrans %}
12+
</p>
13+
</body>
14+
</html>

Diff for: rdiffweb/templates/email_changed.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<html>
22
<head></head>
33
<body>
4-
{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}
5-
<p>{% trans %}You recently changed the email address associated with your {{ header_name }} account.{% endtrans %}</p>
4+
<p>
5+
<a>{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}</a>
6+
</p>
7+
<p>
8+
<a>{% trans %}You recently changed the email address associated with your {{ header_name }} account.{% endtrans %}</a>
9+
</p>
610
<p>
711
{% trans %}If you did not make this change and believe your account has been compromised, please contact your administrator.{% endtrans %}
812
</p>

Diff for: rdiffweb/templates/email_mfa.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<html>
22
<head></head>
33
<body>
4-
{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}
4+
<p>
5+
<a>{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}</a>
6+
</p>
57
<p>
68
{% if user.mfa %}
79
{% trans %}Your {{ header_name }} Account is now protected with Two-Factor Authentication. When you sign in on a new or untrusted device, you'll need your second factor to verify your identity.{% endtrans %}

Diff for: rdiffweb/templates/email_notification.html

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<html>
22
<head></head>
33
<body>
4-
{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}
4+
<p>
5+
<a>{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}</a>
6+
</p>
57
<p>
68
{% trans %}You are receiving this email to notify you about your backups. The
79
following repositories are inactive for some time. We invite you to have a look
810
at your last backup schedule.{% endtrans %}
911
</p>
1012
<ul>
11-
{% for r in repos %}<li>{{ r.display_name }}</li>{% endfor %}
13+
{% for r in repos %}
14+
<li>
15+
<a>{{ r.display_name }}</a>
16+
</li>
17+
{% endfor %}
1218
</ul>
13-
<p>
14-
{% trans %}If you don't want to be notify about this. You need to review your
15-
user preferences.{% endtrans %}
16-
</p>
19+
<p>{% trans %}If you don't want to be notify about this. You need to review your user preferences.{% endtrans %}</p>
1720
</body>
1821
</html>

Diff for: rdiffweb/templates/password_changed.html renamed to rdiffweb/templates/email_password_changed.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<html>
22
<head></head>
33
<body>
4-
{% trans username=user.username %}Hey {{ username }},{% endtrans %}
4+
<p>
5+
<a>{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}</a>
6+
</p>
57
<p>{% trans %}You recently changed the password associated with your {{ header_name }} account.{% endtrans %}</p>
68
<p>
79
{% trans %}If you did not make this change and believe your account has been compromised, please contact your administrator.{% endtrans %}

Diff for: rdiffweb/templates/email_verification_code.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<html>
22
<head></head>
33
<body>
4-
{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}
4+
<p>
5+
<a>{% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %}</a>
6+
</p>
57
<p>
68
{% trans %}To help us make sure it's really you, here's the verification code you'll need to log in:{% endtrans %}
79
</p>

0 commit comments

Comments
 (0)