Retire les bl mail invalide quand on modifie le champ mail ou mailext

This commit is contained in:
Gabriel Detraz 2015-11-28 03:05:40 +01:00
parent e67b3be24b
commit 8c00727456

View file

@ -543,6 +543,15 @@ class Dialog(proprio.Dialog):
with self.conn.search(dn=adherent.dn, scope=0, mode='rw')[0] as adherent:
for (key, values) in attrs.items():
adherent[key] = values
# On retire les éventuelle bl mail invalide
if key == u'mailExt' or key == u'mail':
for bl in adherent['blacklist']:
now = int(time.time())
if bl['type'] == u'mail_invalide' and bl['fin'] > now:
bl['fin'] = now
if bl['debut'] > now:
bl['debut'] = now
bl['comm'] += u'- mail rectifié'
adherent.validate_changes()
adherent.history_gen()
adherent.save()