Projet

Général

Profil

0001-templates-fixes-in-unused-account-emails-41281.patch

Valentin Deniaud, 03 avril 2020 14:24

Télécharger (3,8 ko)

Voir les différences:

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                                     | 3 ++-
 4 files changed, 15 insertions(+), 6 deletions(-)
src/authentic2/templates/authentic2/accounts_delete_request.html
16 16
<form method="post">
17 17
  {% csrf_token %}
18 18
  <p>
19
  {% blocktrans %}
19
  {% blocktrans trimmed %}
20 20
  Do you really want to delete your account?
21 21
  {% endblocktrans %}
22 22
  </p>
23 23
  <p>
24
  {% blocktrans %}
24
  {% blocktrans trimmed %}
25 25
  A validation message will be sent to {{ email }}. You will have to visit the
26 26
  link in this email in order to complete the deletion process.
27 27
  {% endblocktrans %}
src/authentic2/templates/authentic2/unused_account_alert_body.html
1
{% load i18n %}{% autoescape off %}{% blocktrans %}Hi {{ user.get_full_name }},
1
{% load i18n humanize %}
2
{% autoescape off %}
3
{% blocktrans with last_login_date=user.last_login|naturaltime %}
4
Hi {{ user.get_full_name }},
2 5

  
3 6
Your last logging was {{ last_login_date }}.
4
In order to keep your account, you must <a href={{ login_url}}>log in</a> before {{ days_to_deletion }} days.
7
In order to keep your account, you must <a href="{{ login_url }}">log in</a> within {{ days_to_deletion }} days.
5 8
Otherwise, it will be deleted after this time.
6 9
{% endblocktrans %}{% endautoescape %}
src/authentic2/templates/authentic2/unused_account_alert_subject.txt
1
{% load i18n %}{% autoescape off %}{% blocktrans %}Alert: {{ user }} you have not logged since {{ threshold }}{% endblocktrans %}{% endautoescape %}
1
{% load i18n humanize %}
2
{% autoescape off %}
3
{% blocktrans trimmed with last_login_date=user.last_login|naturaltime %}
4
Alert: {{ user.get_full_name }} your last login was {{ last_login_date }}
5
{% endblocktrans %}
6
{% endautoescape %}
tests/test_commands.py
143 143
    management.call_command('clean-unused-accounts')
144 144
    mail = mailoutbox[0]
145 145
    assert formatted in mail.body
146
    assert formatted in mail.subject and not '\n' in mail.subject
146 147

  
147 148
    # deletion email
148 149
    simple_user.last_account_deletion_alert = now() - datetime.timedelta(days=2)
......
160 161
    simple_user.save()
161 162
    management.call_command('clean-unused-accounts')
162 163
    mail = mailoutbox[0]
163
    assert 'href=http://localhost/login' in mail.message().as_string()
164
    assert 'href="http://localhost/login/"' in mail.message().as_string()
164 165

  
165 166

  
166 167
def test_cleanupauthentic(db):
167
-