mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-05 01:16:27 +00:00
Merge branch 'master' of https://gitlab.rezometz.org/rezo/re2o
This commit is contained in:
commit
176fcbbca6
2 changed files with 21 additions and 1 deletions
8
users/templates/users/email_ban_notif
Normal file
8
users/templates/users/email_ban_notif
Normal file
|
@ -0,0 +1,8 @@
|
|||
Bonjour {{name}},
|
||||
|
||||
Vous avez été banni par un administrateur du Rézo en raison de {{raison}}. Vous n'avez plus accès au réseau jusqu'au {{date_end}}.
|
||||
|
||||
Pour de plus amples informations, rendez-vous au C0.
|
||||
|
||||
Cordialement,
|
||||
L'équipe du Rézo.
|
|
@ -77,6 +77,17 @@ def reset_passwd_mail(req, request):
|
|||
EMAIL_FROM, [req.user.email], fail_silently=False)
|
||||
return
|
||||
|
||||
def notif_ban(ban):
|
||||
t = loader.get_template('users/email_ban_notif')
|
||||
c = Context({
|
||||
'name': str(ban.user.name) + ' ' + str(ban.user.surname),
|
||||
'raison': ban.raison,
|
||||
'date_end': ban.date_end,
|
||||
})
|
||||
send_mail('Deconnexion disciplinaire', t.render(c),
|
||||
EMAIL_FROM, [ban.user.email], fail_silently=False)
|
||||
return
|
||||
|
||||
@login_required
|
||||
@permission_required('cableur')
|
||||
def new_user(request):
|
||||
|
@ -209,7 +220,8 @@ def add_ban(request, userid):
|
|||
ban = BanForm(request.POST or None, instance=ban_instance)
|
||||
if ban.is_valid():
|
||||
with transaction.atomic(), reversion.create_revision():
|
||||
ban.save()
|
||||
ban_object = ban.save()
|
||||
notif_ban(ban_object)
|
||||
reversion.set_user(request.user)
|
||||
reversion.set_comment("Création")
|
||||
messages.success(request, "Bannissement ajouté")
|
||||
|
|
Loading…
Reference in a new issue