diff --git a/rdiffweb/core/notification.py b/rdiffweb/core/notification.py index afac0532..50353393 100644 --- a/rdiffweb/core/notification.py +++ b/rdiffweb/core/notification.py @@ -73,7 +73,7 @@ def access_token_added(self, userobj, name): # Send a mail notification body = self.app.templates.compile_template( - "access_token_added.html", **{"header_name": self.app.cfg.header_name, 'user': userobj, 'name': name} + "email_access_token_added.html", **{"header_name": self.app.cfg.header_name, 'user': userobj, 'name': name} ) self.bus.publish('queue_mail', to=userobj.email, subject=_("A new access token has been created"), message=body) @@ -118,7 +118,7 @@ def user_password_changed(self, userobj): # If the email attributes was changed, send a mail notification. body = self.app.templates.compile_template( - "password_changed.html", **{"header_name": self.app.cfg.header_name, 'user': userobj} + "email_password_changed.html", **{"header_name": self.app.cfg.header_name, 'user': userobj} ) self.bus.publish('queue_mail', to=userobj.email, subject=_("Password changed"), message=body) diff --git a/rdiffweb/core/tests/test_notification.py b/rdiffweb/core/tests/test_notification.py index 3d82a503..ddfae0cf 100644 --- a/rdiffweb/core/tests/test_notification.py +++ b/rdiffweb/core/tests/test_notification.py @@ -64,7 +64,7 @@ def test_notification_job(self): self.listener.queue_email.assert_called_once_with( to='test@test.com', subject='Notification', - message="\n \n \n Hey admin,\n

\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

\n \n

\n If you don't want to be notify about this. You need to review your\n user preferences.\n

\n \n", + message="\n \n \n

\n Hey admin,\n

\n

\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

\n \n

If you don't want to be notify about this. You need to review your user preferences.

\n \n", ) def test_notification_job_undefined_last_backup_date(self): @@ -85,7 +85,7 @@ def test_notification_job_undefined_last_backup_date(self): self.listener.queue_email.assert_called_once_with( to='test@test.com', subject='Notification', - message="\n \n \n Hey admin,\n

\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

\n \n

\n If you don't want to be notify about this. You need to review your\n user preferences.\n

\n \n", + message="\n \n \n

\n Hey admin,\n

\n

\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

\n \n

If you don't want to be notify about this. You need to review your user preferences.

\n \n", ) def test_notification_job_without_notification(self): @@ -135,7 +135,7 @@ def test_email_changed(self): self.listener.queue_email.assert_called_once_with( to='original_email@test.com', subject='Email address changed', - message='\n \n \n Hey admin,\n

You recently changed the email address associated with your Rdiffweb account.

\n

\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n

\n \n', + message='\n \n \n

\n Hey admin,\n

\n

\n You recently changed the email address associated with your Rdiffweb account.\n

\n

\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n

\n \n', ) def test_email_updated_with_same_value(self): @@ -167,7 +167,7 @@ def test_password_change_notification(self): self.listener.queue_email.assert_called_once_with( to='password_change@test.com', subject='Password changed', - message='\n \n \n Hey admin,\n

You recently changed the password associated with your Rdiffweb account.

\n

\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n

\n \n', + message='\n \n \n

\n Hey admin,\n

\n

You recently changed the password associated with your Rdiffweb account.

\n

\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n

\n \n', ) def test_password_change_with_same_value(self): @@ -186,5 +186,5 @@ def test_password_change_with_same_value(self): self.listener.queue_email.assert_called_once_with( to='password_change@test.com', subject='Password changed', - message='\n \n \n Hey admin,\n

You recently changed the password associated with your Rdiffweb account.

\n

\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n

\n \n', + message='\n \n \n

\n Hey admin,\n

\n

You recently changed the password associated with your Rdiffweb account.

\n

\n If you did not make this change and believe your account has been compromised, please contact your administrator.\n

\n \n', ) diff --git a/rdiffweb/templates/access_token_added.html b/rdiffweb/templates/access_token_added.html deleted file mode 100644 index 53b6bf5c..00000000 --- a/rdiffweb/templates/access_token_added.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - {% trans username=user.username %}Hey {{ username }},{% endtrans %} -

{% trans %}A new access token, named "{{ name }}", has been created.{% endtrans %}

-

- {% trans %}If you did not make this change and believe your account has been compromised, please contact your administrator.{% endtrans %} -

- - diff --git a/rdiffweb/templates/email_access_token_added.html b/rdiffweb/templates/email_access_token_added.html new file mode 100644 index 00000000..91021126 --- /dev/null +++ b/rdiffweb/templates/email_access_token_added.html @@ -0,0 +1,14 @@ + + + +

+ {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

+

+ {% trans %}A new access token, named "{{ name }}", has been created.{% endtrans %} +

+

+ {% trans %}If you did not make this change and believe your account has been compromised, please contact your administrator.{% endtrans %} +

+ + diff --git a/rdiffweb/templates/email_changed.html b/rdiffweb/templates/email_changed.html index 4293a1a5..5b40ce14 100644 --- a/rdiffweb/templates/email_changed.html +++ b/rdiffweb/templates/email_changed.html @@ -1,8 +1,12 @@ - {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} -

{% trans %}You recently changed the email address associated with your {{ header_name }} account.{% endtrans %}

+

+ {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

+

+ {% trans %}You recently changed the email address associated with your {{ header_name }} account.{% endtrans %} +

{% trans %}If you did not make this change and believe your account has been compromised, please contact your administrator.{% endtrans %}

diff --git a/rdiffweb/templates/email_mfa.html b/rdiffweb/templates/email_mfa.html index be264bcb..64be636c 100644 --- a/rdiffweb/templates/email_mfa.html +++ b/rdiffweb/templates/email_mfa.html @@ -1,7 +1,9 @@ - {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

+ {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

{% if user.mfa %} {% 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 --git a/rdiffweb/templates/email_notification.html b/rdiffweb/templates/email_notification.html index 2ad8270e..d0dc6d53 100644 --- a/rdiffweb/templates/email_notification.html +++ b/rdiffweb/templates/email_notification.html @@ -1,18 +1,21 @@ - {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

+ {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

{% trans %}You are receiving this email to notify you about your backups. The following repositories are inactive for some time. We invite you to have a look at your last backup schedule.{% endtrans %}

-

- {% trans %}If you don't want to be notify about this. You need to review your - user preferences.{% endtrans %} -

+

{% trans %}If you don't want to be notify about this. You need to review your user preferences.{% endtrans %}

diff --git a/rdiffweb/templates/password_changed.html b/rdiffweb/templates/email_password_changed.html similarity index 73% rename from rdiffweb/templates/password_changed.html rename to rdiffweb/templates/email_password_changed.html index 13bbbbd0..0e3a8f3d 100644 --- a/rdiffweb/templates/password_changed.html +++ b/rdiffweb/templates/email_password_changed.html @@ -1,7 +1,9 @@ - {% trans username=user.username %}Hey {{ username }},{% endtrans %} +

+ {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

{% trans %}You recently changed the password associated with your {{ header_name }} account.{% endtrans %}

{% trans %}If you did not make this change and believe your account has been compromised, please contact your administrator.{% endtrans %} diff --git a/rdiffweb/templates/email_verification_code.html b/rdiffweb/templates/email_verification_code.html index da796644..20db2fe6 100644 --- a/rdiffweb/templates/email_verification_code.html +++ b/rdiffweb/templates/email_verification_code.html @@ -1,7 +1,9 @@ - {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

+ {% trans username=(user.fullname or user.username) %}Hey {{ username }},{% endtrans %} +

{% trans %}To help us make sure it's really you, here's the verification code you'll need to log in:{% endtrans %}