0001-custom_user-provide-more-generic-user-inactivity-not.patch
src/authentic2/templates/authentic2/unused_account_alert_body.html | ||
---|---|---|
1 | 1 |
{% load i18n humanize %} |
2 | 2 |
<p>{% blocktrans %}Hi {{ user }},{% endblocktrans %}</p> |
3 | 3 | |
4 |
<p>{% blocktrans with last_login_date=user.last_login|naturaltime %}Your last logging was {{ last_login_date }}.{% endblocktrans %}</p>
|
|
4 |
<p>{% blocktrans %}Your account is inactive and is pending deletion.{% endblocktrans %}</p>
|
|
5 | 5 |
<p>{% blocktrans %}In order to keep your account, you must <a href="{{ login_url }}">log in</a> within {{ days_to_deletion }} days.{% endblocktrans %}</p> |
6 |
<p>{% trans "Otherwise, it will be deleted after this time." %}</p> |
|
6 |
<p>{% trans "Past this delay, it will be deleted." %}</p> |
src/authentic2/templates/authentic2/unused_account_alert_body.txt | ||
---|---|---|
1 | 1 |
{% load i18n humanize %}{% blocktrans %}Hi {{ user }},{% endblocktrans %} |
2 | 2 | |
3 |
{% blocktrans with last_login_date=user.last_login|naturaltime %}Your last logging was {{ last_login_date }}.{% endblocktrans %}
|
|
3 |
{% blocktrans %}Your account is inactive and is pending deletion.{% endblocktrans %}
|
|
4 | 4 |
{% blocktrans %}In order to keep your account, you must log in within {{ days_to_deletion }} days.{% endblocktrans %} |
5 |
{% trans "Otherwise, it will be deleted after this time." %} |
|
5 |
{% trans "Past this delay, it will be deleted." %} |
src/authentic2/templates/authentic2/unused_account_alert_subject.txt | ||
---|---|---|
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 %} |
|
1 |
{% 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 %} |
src/authentic2/templates/authentic2/unused_account_delete_body.html | ||
---|---|---|
1 |
{% load i18n humanize %} |
|
2 |
<p>{% blocktrans %}Hi {{ user }},{% endblocktrans %}</p> |
|
3 | ||
4 |
<p>{% blocktrans %}Your account was inactive, it has been deleted.{% endblocktrans %}</p> |
src/authentic2/templates/authentic2/unused_account_delete_body.txt | ||
---|---|---|
1 |
{% load i18n humanize %}{% blocktrans with last_login_date=user.last_login|naturaltime %}
|
|
1 |
{% load i18n humanize %}{% blocktrans %} |
|
2 | 2 |
Hi {{ user }}, |
3 | 3 | |
4 |
Since your last logging was {{ last_login_date }}, your account has been deleted.{% endblocktrans %} |
|
4 |
Your account was inactive, it has been deleted.{% endblocktrans %} |
tests/test_commands.py | ||
---|---|---|
228 | 228 |
assert len(mailoutbox) == 1 |
229 | 229 | |
230 | 230 | |
231 |
@pytest.mark.parametrize( |
|
232 |
"deletion_delay,formatted", [(730, '2\xa0years'), (500, '1\xa0year'), (65, '2\xa0months')] |
|
233 |
) |
|
234 |
def test_clean_unused_account_human_duration_format(simple_user, mailoutbox, deletion_delay, formatted): |
|
231 |
@pytest.mark.parametrize("deletion_delay", [730, 500, 65]) |
|
232 |
def test_clean_unused_account_human_duration_format(simple_user, mailoutbox, deletion_delay): |
|
235 | 233 |
simple_user.ou.clean_unused_accounts_alert = deletion_delay - 1 |
236 | 234 |
simple_user.ou.clean_unused_accounts_deletion = deletion_delay |
237 | 235 |
simple_user.ou.save() |
... | ... | |
241 | 239 |
# alert email |
242 | 240 |
call_command('clean-unused-accounts') |
243 | 241 |
mail = mailoutbox[0] |
244 |
assert formatted in mail.body |
|
245 |
assert formatted in mail.subject and not '\n' in mail.subject |
|
242 |
assert '\n' not in mail.subject |
|
246 | 243 | |
247 | 244 |
# deletion email |
248 | 245 |
simple_user.last_account_deletion_alert = now() - datetime.timedelta(days=2) |
249 | 246 |
simple_user.save() |
250 | 247 |
call_command('clean-unused-accounts') |
251 | 248 |
mail = mailoutbox[1] |
252 |
assert formatted in mail.body |
|
253 | 249 | |
254 | 250 | |
255 | 251 |
def test_clean_unused_account_login_url(simple_user, mailoutbox): |
256 |
- |