From 31c9b386f2e0159c0682129c6b7b2dcdfe2e512b Mon Sep 17 00:00:00 2001
From: Paul Marillonnet <pmarillonnet@entrouvert.com>
Date: Mon, 6 Feb 2023 09:11:25 +0100
Subject: [PATCH] custom_user: provide more generic user-inactivity
 notifications (#74178)

Authentic now exposes a keepalive API endpoint, meaning that the user's
last activity event was not necessarily a user login event.
---
 .../templates/authentic2/unused_account_alert_body.html       | 2 +-
 .../templates/authentic2/unused_account_alert_body.txt        | 2 +-
 .../templates/authentic2/unused_account_alert_subject.txt     | 2 +-
 .../templates/authentic2/unused_account_delete_body.html      | 4 ++++
 .../templates/authentic2/unused_account_delete_body.txt       | 2 +-
 5 files changed, 8 insertions(+), 4 deletions(-)
 create mode 100644 src/authentic2/templates/authentic2/unused_account_delete_body.html

diff --git a/src/authentic2/templates/authentic2/unused_account_alert_body.html b/src/authentic2/templates/authentic2/unused_account_alert_body.html
index 041f17509..018fa867a 100644
--- a/src/authentic2/templates/authentic2/unused_account_alert_body.html
+++ b/src/authentic2/templates/authentic2/unused_account_alert_body.html
@@ -1,6 +1,6 @@
 {% load i18n humanize %}
 <p>{% blocktrans %}Hi {{ user }},{% endblocktrans %}</p>
 
-<p>{% blocktrans with last_login_date=user.last_login|naturaltime %}Your last logging was {{ last_login_date }}.{% endblocktrans %}</p>
+<p>{% blocktrans with last_login_date=user.last_login|naturaltime %}Your account was last active on {{ last_login_date }}.{% endblocktrans %}</p>
 <p>{% blocktrans %}In order to keep your account, you must <a href="{{ login_url }}">log in</a> within {{ days_to_deletion }} days.{% endblocktrans %}</p>
 <p>{% trans "Otherwise, it will be deleted after this time." %}</p>
diff --git a/src/authentic2/templates/authentic2/unused_account_alert_body.txt b/src/authentic2/templates/authentic2/unused_account_alert_body.txt
index b509f2e32..dce5a8d0a 100644
--- a/src/authentic2/templates/authentic2/unused_account_alert_body.txt
+++ b/src/authentic2/templates/authentic2/unused_account_alert_body.txt
@@ -1,5 +1,5 @@
 {% load i18n humanize %}{% blocktrans %}Hi {{ user }},{% endblocktrans %}
 
-{% blocktrans with last_login_date=user.last_login|naturaltime %}Your last logging was {{ last_login_date }}.{% endblocktrans %}
+{% blocktrans with last_login_date=user.last_login|naturaltime %}Your account was last active on {{ last_login_date }}.{% endblocktrans %}
 {% blocktrans %}In order to keep your account, you must log in within {{ days_to_deletion }} days.{% endblocktrans %}
 {% trans "Otherwise, it will be deleted after this time." %}
diff --git a/src/authentic2/templates/authentic2/unused_account_alert_subject.txt b/src/authentic2/templates/authentic2/unused_account_alert_subject.txt
index a3c4988e4..48aa1092d 100644
--- a/src/authentic2/templates/authentic2/unused_account_alert_subject.txt
+++ b/src/authentic2/templates/authentic2/unused_account_alert_subject.txt
@@ -1 +1 @@
-{% load i18n humanize %}{% blocktrans trimmed with last_login_date=user.last_login|naturaltime %}Alert: {{ user.get_full_name }} your last login was {{ last_login_date }}{% endblocktrans %}
+{% load i18n humanize %}{% blocktrans trimmed with last_login_date=user.last_login|naturaltime %}Alert: {{ user.get_full_name }}, your account was last active on {{ last_login_date }}{% endblocktrans %}
diff --git a/src/authentic2/templates/authentic2/unused_account_delete_body.html b/src/authentic2/templates/authentic2/unused_account_delete_body.html
new file mode 100644
index 000000000..fa5623777
--- /dev/null
+++ b/src/authentic2/templates/authentic2/unused_account_delete_body.html
@@ -0,0 +1,4 @@
+{% load i18n humanize %}
+<p>{% blocktrans %}Hi {{ user }},{% endblocktrans %}</p>
+
+<p>{% blocktrans with last_login_date=user.last_login|naturaltime %}Since your account was last active on {{ last_login_date }}, your account has been deleted.{% endblocktrans %}</p>
diff --git a/src/authentic2/templates/authentic2/unused_account_delete_body.txt b/src/authentic2/templates/authentic2/unused_account_delete_body.txt
index cf5fd35cd..fe9304c9b 100644
--- a/src/authentic2/templates/authentic2/unused_account_delete_body.txt
+++ b/src/authentic2/templates/authentic2/unused_account_delete_body.txt
@@ -1,4 +1,4 @@
 {% load i18n humanize %}{% blocktrans with last_login_date=user.last_login|naturaltime %}
 Hi {{ user }},
 
-Since your last logging was {{ last_login_date }}, your account has been deleted.{% endblocktrans %}
+Since your account was last active on {{ last_login_date }}, your account has been deleted.{% endblocktrans %}
-- 
2.39.1

