apps: corrige la notificatoin par mail des changements (#15261)
This commit is contained in:
parent
fd21f3f2b2
commit
4df9b2a8d2
|
@ -465,14 +465,19 @@ class AppConfig(django.apps.AppConfig):
|
|||
|
||||
def log_modification(self, actor, subject, message, mail=True):
|
||||
from . import models
|
||||
from authentic2.utils import send_templated_mail
|
||||
|
||||
models.Journal.objects.create(
|
||||
actor=actor,
|
||||
subject=subject,
|
||||
message=message)
|
||||
# pour les modifications sur les usagers on envoie un mail à l'usager
|
||||
if subject.ou and subject.ou.slug == 'usagers' and mail:
|
||||
if mail:
|
||||
self.mail_notification(actor, subject, message)
|
||||
|
||||
def mail_notification(self, actor, subject, message):
|
||||
from authentic2.utils import send_templated_mail
|
||||
|
||||
if subject.ou and subject.ou.slug == 'usagers':
|
||||
send_templated_mail(subject, 'authentic2/cut-notify-usager-modification',
|
||||
context={
|
||||
'message': message,
|
||||
|
@ -534,10 +539,14 @@ class AppConfig(django.apps.AppConfig):
|
|||
self.log_action(user, msg)
|
||||
self.stat('sso-success', service.slug)
|
||||
|
||||
def cut_event_cut_edit_core(self, user, **kwargs):
|
||||
def cut_event_cut_edit_core(self, user, form, **kwargs):
|
||||
if not form.has_changed():
|
||||
return
|
||||
self.log_action(user, u'édition du profil coeur')
|
||||
|
||||
def cut_event_cut_edit_crown(self, user, **kwargs):
|
||||
def cut_event_cut_edit_crown(self, user, form, **kwargs):
|
||||
if not form.has_changed():
|
||||
return
|
||||
self.log_action(user, u'édition du profil couronne')
|
||||
|
||||
def cut_event_password_reset_confirm(self, user, **kwargs):
|
||||
|
@ -569,12 +578,20 @@ class AppConfig(django.apps.AppConfig):
|
|||
def cut_event_manager_add_user(self, user, instance, **kwargs):
|
||||
self.log_modification(user, instance, u'création d\'un utilisateur')
|
||||
|
||||
def cut_event_manager_edit_user(self, user, instance, **kwargs):
|
||||
if instance.ou and instance.ou.slug != 'usagers':
|
||||
def cut_event_manager_edit_user(self, user, instance, form, **kwargs):
|
||||
if not form.has_changed():
|
||||
return
|
||||
if instance.ou and instance.ou.slug == 'usagers':
|
||||
if instance.attributes.validated:
|
||||
self.log_modification(user, instance, u'modification du profil couronne')
|
||||
else:
|
||||
self.log_modification(user, instance, u'modification du profil coeur et couronne')
|
||||
else:
|
||||
self.log_modification(user, instance, u'modification du profil')
|
||||
|
||||
def cut_event_manager_delete_user(self, user, instance, **kwargs):
|
||||
self.log_action(self, user, u'suppression de l\'utilisateur %s' % instance)
|
||||
self.log_action(user, u'suppression de l\'utilisateur %s' % instance)
|
||||
self.mail_notification(user, instance, u'suppression de votre compte')
|
||||
|
||||
def cut_event_manager_add_role_member(self, user, role, member, **kwargs):
|
||||
self.log_modification(user, member, u'ajoute le rôle %s' % role)
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<p>Bonjour,</p>
|
||||
|
||||
<p>
|
||||
Un agent vient de modifier votre compte de la manière suivante:
|
||||
Un agent vient de modifier votre compte de la manière suivante :
|
||||
</p>
|
||||
|
||||
<ul><li>{{ message }}</li></ul>
|
||||
|
|
Loading…
Reference in New Issue