From d8321220681fc99e674506ffbaef9b51db7c171a Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Thu, 12 Mar 2020 18:16:13 +0100 Subject: [PATCH] templates: better account deletion request message (#39980) --- .../templates/authentic2/accounts_delete_request.html | 10 +++++++++- src/authentic2/views.py | 5 +++++ tests/test_views.py | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/authentic2/templates/authentic2/accounts_delete_request.html b/src/authentic2/templates/authentic2/accounts_delete_request.html index 36a5555f..2c2ae327 100644 --- a/src/authentic2/templates/authentic2/accounts_delete_request.html +++ b/src/authentic2/templates/authentic2/accounts_delete_request.html @@ -16,7 +16,15 @@
{% csrf_token %}

- {% trans "Send an account-deletion validation code?" %} + {% blocktrans %} + Do you really want to delete your account ? + {% endblocktrans %} +

+

+ {% blocktrans %} + 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/views.py b/src/authentic2/views.py index e81c3f0b..572c5ccb 100644 --- a/src/authentic2/views.py +++ b/src/authentic2/views.py @@ -1102,6 +1102,11 @@ class DeleteView(TemplateView): _("An account deletion validation email has been sent to your email address.")) return utils.redirect(request, 'account_management') + def get_context_data(self, **kwargs): + ctx = super(DeleteView, self).get_context_data(**kwargs) + ctx['email'] = self.request.user.email + return ctx + class ValidateDeletionView(TemplateView): template_name = 'authentic2/accounts_delete_validation.html' diff --git a/tests/test_views.py b/tests/test_views.py index 4af3c616..82c11ffd 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -42,6 +42,7 @@ def test_account_delete(app, simple_user, mailoutbox): assert simple_user.is_active assert not len(mailoutbox) page = login(app, simple_user, path=reverse('delete_account')) + assert simple_user.email in page.text page.form.submit(name='submit').follow() assert len(mailoutbox) == 1 link = get_link_from_mail(mailoutbox[0]) -- 2.20.1