From fbf53353ced384b87257aa8ba0b761e9d7e9381c Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Thu, 2 Apr 2020 18:02:36 +0200 Subject: [PATCH] templates: fixes in unused account emails (#41281) --- .../templates/authentic2/accounts_delete_request.html | 4 ++-- .../templates/authentic2/unused_account_alert_body.html | 7 +++++-- .../templates/authentic2/unused_account_alert_subject.txt | 7 ++++++- tests/test_commands.py | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/authentic2/templates/authentic2/accounts_delete_request.html b/src/authentic2/templates/authentic2/accounts_delete_request.html index 0ea3a835..9efcd9bb 100644 --- a/src/authentic2/templates/authentic2/accounts_delete_request.html +++ b/src/authentic2/templates/authentic2/accounts_delete_request.html @@ -16,12 +16,12 @@
{% csrf_token %}

- {% blocktrans %} + {% blocktrans trimmed %} Do you really want to delete your account? {% endblocktrans %}

- {% blocktrans %} + {% blocktrans trimmed %} A validation message will be sent to {{ email }}. You will have to visit the link in this email in order to complete the deletion process. {% endblocktrans %} diff --git a/src/authentic2/templates/authentic2/unused_account_alert_body.html b/src/authentic2/templates/authentic2/unused_account_alert_body.html index f3a978b9..65e52dc0 100644 --- a/src/authentic2/templates/authentic2/unused_account_alert_body.html +++ b/src/authentic2/templates/authentic2/unused_account_alert_body.html @@ -1,6 +1,9 @@ -{% load i18n %}{% autoescape off %}{% blocktrans %}Hi {{ user.get_full_name }}, +{% load i18n humanize %} +{% autoescape off %} +{% blocktrans with last_login_date=user.last_login|naturaltime %} +Hi {{ user.get_full_name }}, Your last logging was {{ last_login_date }}. -In order to keep your account, you must log in before {{ days_to_deletion }} days. +In order to keep your account, you must log in within {{ days_to_deletion }} days. Otherwise, it will be deleted after this time. {% endblocktrans %}{% endautoescape %} diff --git a/src/authentic2/templates/authentic2/unused_account_alert_subject.txt b/src/authentic2/templates/authentic2/unused_account_alert_subject.txt index 30b89996..0649ed5d 100644 --- a/src/authentic2/templates/authentic2/unused_account_alert_subject.txt +++ b/src/authentic2/templates/authentic2/unused_account_alert_subject.txt @@ -1 +1,6 @@ -{% load i18n %}{% autoescape off %}{% blocktrans %}Alert: {{ user }} you have not logged since {{ threshold }}{% endblocktrans %}{% endautoescape %} +{% load i18n humanize %} +{% autoescape off %} +{% blocktrans trimmed with last_login_date=user.last_login|naturaltime %} +Alert: {{ user.get_full_name }} your last login was {{ last_login_date }} +{% endblocktrans %} +{% endautoescape %} diff --git a/tests/test_commands.py b/tests/test_commands.py index a57230dd..dee66311 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -143,6 +143,7 @@ def test_clean_unused_account_human_duration_format(simple_user, mailoutbox, del management.call_command('clean-unused-accounts') mail = mailoutbox[0] assert formatted in mail.body + assert formatted in mail.subject # deletion email simple_user.last_account_deletion_alert = now() - datetime.timedelta(days=2) -- 2.20.1