0001-misc-add-template-vars-to-evaluation-context-of-unus.patch
src/authentic2/management/commands/clean-unused-accounts.py | ||
---|---|---|
16 | 16 | |
17 | 17 |
from __future__ import print_function |
18 | 18 | |
19 |
import copy |
|
19 | 20 |
import logging |
20 | 21 | |
21 | 22 |
from datetime import timedelta |
... | ... | |
27 | 28 |
from django.utils.six.moves.urllib import parse as urlparse |
28 | 29 |
from django_rbac.utils import get_ou_model |
29 | 30 | |
31 |
from authentic2 import app_settings |
|
30 | 32 |
from authentic2.utils import send_templated_mail |
31 | 33 | |
32 | 34 |
from django.conf import settings |
... | ... | |
98 | 100 |
self.delete_user(user) |
99 | 101 | |
100 | 102 |
def send_alert(self, user, days_to_deletion): |
101 |
ctx = { |
|
103 |
ctx = copy.copy(app_settings.TEMPLATE_VARS) |
|
104 |
ctx.update({ |
|
102 | 105 |
'user': user, |
103 | 106 |
'days_to_deletion': days_to_deletion, |
104 | 107 |
'login_url': urlparse.urljoin(settings.SITE_BASE_URL, settings.LOGIN_URL), |
105 |
} |
|
108 |
})
|
|
106 | 109 |
with atomic(): |
107 | 110 |
if not self.fake: |
108 | 111 |
User.objects.filter(pk=user.pk).update(last_account_deletion_alert=self.now) |
... | ... | |
117 | 120 |
send_templated_mail(user.email, prefix, ctx) |
118 | 121 | |
119 | 122 |
def delete_user(self, user): |
120 |
ctx = {'user': user} |
|
123 |
ctx = copy.copy(app_settings.TEMPLATE_VARS) |
|
124 |
ctx.update({'user': user}) |
|
121 | 125 |
with atomic(): |
122 | 126 |
if not self.fake: |
123 | 127 |
user.mark_as_deleted(timestamp=self.now) |
124 |
- |