Vérification qu'un mailAlias est @crans.org
This commit is contained in:
parent
e1079463fc
commit
bfff595251
1 changed files with 10 additions and 0 deletions
10
attributs.py
10
attributs.py
|
@ -785,6 +785,16 @@ class mailAlias(mail):
|
||||||
category = 'mail'
|
category = 'mail'
|
||||||
ldap_name = "mailAlias"
|
ldap_name = "mailAlias"
|
||||||
|
|
||||||
|
def parse_value(self, mail):
|
||||||
|
"""Vérifie que le mail est un mail @crans.org"""
|
||||||
|
# comme on utilise mailExt comme mail de secours si l'utilisateur
|
||||||
|
# à perdu ses id crans, ça ne sert à rien de mettre ne adresse crans
|
||||||
|
if u'@' in mail:
|
||||||
|
if not mail.endswith("@crans.org"):
|
||||||
|
raise ValueError("Un %s doit être une adresse crans." % str(self.legend))
|
||||||
|
mail = mail.split(u'@', 1)[0] + u'@crans.org'
|
||||||
|
super(mailAlias, self).parse_value(mail)
|
||||||
|
|
||||||
@crans_attribute
|
@crans_attribute
|
||||||
class mailExt(mail):
|
class mailExt(mail):
|
||||||
__slots__ = ()
|
__slots__ = ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue