0001-templates-better-account-deletion-request-message-39.patch
src/authentic2/templates/authentic2/accounts_delete_request.html | ||
---|---|---|
16 | 16 |
<form method="post"> |
17 | 17 |
{% csrf_token %} |
18 | 18 |
<p> |
19 |
{% trans "Send an account-deletion validation code?" %} |
|
19 |
{% blocktrans %} |
|
20 |
Do you really want to delete your account ? |
|
21 |
{% endblocktrans %} |
|
22 |
</p> |
|
23 |
<p> |
|
24 |
{% blocktrans %} |
|
25 |
A validation message will be sent to {{ email }}. You will have to visit the |
|
26 |
link in this email in order to complete the deletion process. |
|
27 |
{% endblocktrans %} |
|
20 | 28 |
</p> |
21 | 29 |
<button class="submit-button" name="submit">{% trans "Send the code" %}</button> |
22 | 30 |
<button class="cancel-button" name="cancel" formnovalidate>{% trans "Cancel" %}</button> |
src/authentic2/views.py | ||
---|---|---|
1102 | 1102 |
_("An account deletion validation email has been sent to your email address.")) |
1103 | 1103 |
return utils.redirect(request, 'account_management') |
1104 | 1104 | |
1105 |
def get_context_data(self, **kwargs): |
|
1106 |
ctx = super(DeleteView, self).get_context_data(**kwargs) |
|
1107 |
ctx['email'] = self.request.user.email |
|
1108 |
return ctx |
|
1109 | ||
1105 | 1110 | |
1106 | 1111 |
class ValidateDeletionView(TemplateView): |
1107 | 1112 |
template_name = 'authentic2/accounts_delete_validation.html' |
tests/test_views.py | ||
---|---|---|
42 | 42 |
assert simple_user.is_active |
43 | 43 |
assert not len(mailoutbox) |
44 | 44 |
page = login(app, simple_user, path=reverse('delete_account')) |
45 |
assert simple_user.email in page.text |
|
45 | 46 |
page.form.submit(name='submit').follow() |
46 | 47 |
assert len(mailoutbox) == 1 |
47 | 48 |
link = get_link_from_mail(mailoutbox[0]) |
48 |
- |