mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 03:43:12 +00:00
Merge branch 'master' of https://gitlab.rezometz.org/rezo/re2o
This commit is contained in:
commit
a637ddc068
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)
|
EMAIL_FROM, [req.user.email], fail_silently=False)
|
||||||
return
|
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
|
@login_required
|
||||||
@permission_required('cableur')
|
@permission_required('cableur')
|
||||||
def new_user(request):
|
def new_user(request):
|
||||||
|
@ -209,7 +220,8 @@ def add_ban(request, userid):
|
||||||
ban = BanForm(request.POST or None, instance=ban_instance)
|
ban = BanForm(request.POST or None, instance=ban_instance)
|
||||||
if ban.is_valid():
|
if ban.is_valid():
|
||||||
with transaction.atomic(), reversion.create_revision():
|
with transaction.atomic(), reversion.create_revision():
|
||||||
ban.save()
|
ban_object = ban.save()
|
||||||
|
notif_ban(ban_object)
|
||||||
reversion.set_user(request.user)
|
reversion.set_user(request.user)
|
||||||
reversion.set_comment("Création")
|
reversion.set_comment("Création")
|
||||||
messages.success(request, "Bannissement ajouté")
|
messages.success(request, "Bannissement ajouté")
|
||||||
|
|
Loading…
Reference in a new issue