[SOGo] On patche un peu partout pour pouvoir rendre le champ mail de ldap plus propre.
Ignore-this: aed0fb0c7f88d3feb1f0be35b11780bf darcs-hash:20121201132852-b6762-f77d73b568bc1ad0fef3c9341cb2a00a34a09a0c.gz
This commit is contained in:
parent
e6777ccb12
commit
ab6202f37c
5 changed files with 21 additions and 14 deletions
|
@ -130,7 +130,7 @@ class droits_ldap(CransLdap, droits):
|
||||||
mail = adher.mail().lower()
|
mail = adher.mail().lower()
|
||||||
if mail in mail_traite : continue
|
if mail in mail_traite : continue
|
||||||
mail_traite.append(mail)
|
mail_traite.append(mail)
|
||||||
if mail.find('@') == -1 : mail += '@crans.org'
|
if adher._data.get('uid', '') != '' and not mail.endswith('@crans.org') : mail += '@crans.org'
|
||||||
if mail not in deja_inscrits.keys() :
|
if mail not in deja_inscrits.keys() :
|
||||||
# Visiblement pas inscrit
|
# Visiblement pas inscrit
|
||||||
to_add.append([ mail, adher.Nom() ])
|
to_add.append([ mail, adher.Nom() ])
|
||||||
|
|
|
@ -421,7 +421,7 @@ def set_mail_ext(adher):
|
||||||
Demande l'adresse mail extérieure d'un adhérent
|
Demande l'adresse mail extérieure d'un adhérent
|
||||||
"""
|
"""
|
||||||
default = adher.mail()
|
default = adher.mail()
|
||||||
if default.find('@') == -1:
|
if default.endswith('@crans.org'):
|
||||||
# C'était une adresse crans
|
# C'était une adresse crans
|
||||||
default = ''
|
default = ''
|
||||||
|
|
||||||
|
@ -663,7 +663,7 @@ def del_adher(adher):
|
||||||
return
|
return
|
||||||
|
|
||||||
quoi = u'Toutes les machines associées à cet adhérent seront détruites'
|
quoi = u'Toutes les machines associées à cet adhérent seront détruites'
|
||||||
if adher.mail().find('@') == -1:
|
if adher._data.get('uid', '') != '':
|
||||||
# L'adhérent a un compte
|
# L'adhérent a un compte
|
||||||
machines = adher.machines()
|
machines = adher.machines()
|
||||||
if not machines:
|
if not machines:
|
||||||
|
@ -1631,7 +1631,8 @@ def new_adher(adher):
|
||||||
no, res = dialog(arg)
|
no, res = dialog(arg)
|
||||||
if not no:
|
if not no:
|
||||||
mail = adher.mail()
|
mail = adher.mail()
|
||||||
if mail.find('@') == -1: mail += '@crans.org'
|
if adher._data.get('uid', '') != '' and not mail.endswith('@crans.org'):
|
||||||
|
mail += '@crans.org'
|
||||||
adher.services_to_restart('ML_ens', [mail])
|
adher.services_to_restart('ML_ens', [mail])
|
||||||
|
|
||||||
def modif_adher(adher):
|
def modif_adher(adher):
|
||||||
|
|
|
@ -2113,7 +2113,11 @@ class Adherent(BaseProprietaire):
|
||||||
|
|
||||||
def mail(self, new=None):
|
def mail(self, new=None):
|
||||||
if new == None:
|
if new == None:
|
||||||
return decode(self._data.get('mail', [''])[0])
|
email = self._data.get('mail', [''])[0]
|
||||||
|
if not '@' in email:
|
||||||
|
return decode(email)+'@crans.org'
|
||||||
|
else:
|
||||||
|
return decode(email)
|
||||||
|
|
||||||
new = validate_mail(new)
|
new = validate_mail(new)
|
||||||
|
|
||||||
|
@ -2299,10 +2303,7 @@ class Adherent(BaseProprietaire):
|
||||||
Si login = None, retourne le compte de l'adhérent
|
Si login = None, retourne le compte de l'adhérent
|
||||||
"""
|
"""
|
||||||
if not login:
|
if not login:
|
||||||
if self.mail().find('@') != -1:
|
return self._data.get('uid', [''])[0]
|
||||||
return ''
|
|
||||||
else:
|
|
||||||
return self.mail()
|
|
||||||
|
|
||||||
# Supression des accents et espaces
|
# Supression des accents et espaces
|
||||||
login = strip_accents(login)
|
login = strip_accents(login)
|
||||||
|
@ -2343,6 +2344,7 @@ class Adherent(BaseProprietaire):
|
||||||
# Lock du mail
|
# Lock du mail
|
||||||
self.lock('mail', login)
|
self.lock('mail', login)
|
||||||
|
|
||||||
|
# SOGO IS HUNGRY (modifier [login] en ["%s@crans.org"%(login)] quand tout sera ok)
|
||||||
self._data['mail'] = [login]
|
self._data['mail'] = [login]
|
||||||
if not 'compte' in self.modifs:
|
if not 'compte' in self.modifs:
|
||||||
self.modifs.setdefault('compte', None)
|
self.modifs.setdefault('compte', None)
|
||||||
|
|
|
@ -403,7 +403,7 @@ def adher_details(adher) :
|
||||||
|
|
||||||
# Mail
|
# Mail
|
||||||
GL = RMH = u''
|
GL = RMH = u''
|
||||||
if adher.mail().find(u'@')!=-1 or adher.mail() == '':
|
if adher.mail() == '' or adher.compte() == '':
|
||||||
f += coul(u'Adresse mail : ','gras')
|
f += coul(u'Adresse mail : ','gras')
|
||||||
if adher.mail() == '':
|
if adher.mail() == '':
|
||||||
f += coul('INCONNUE','rouge')
|
f += coul('INCONNUE','rouge')
|
||||||
|
@ -415,9 +415,9 @@ def adher_details(adher) :
|
||||||
else :
|
else :
|
||||||
f += coul(u'Login : ','gras')
|
f += coul(u'Login : ','gras')
|
||||||
if adher.mail_invalide():
|
if adher.mail_invalide():
|
||||||
f += coul(adher.mail(),'rouge')
|
f += coul(adher.compte(),'rouge')
|
||||||
else:
|
else:
|
||||||
f += adher.mail()
|
f += adher.compte()
|
||||||
f += "\t"
|
f += "\t"
|
||||||
# controurneGreylisting
|
# controurneGreylisting
|
||||||
if not adher.contourneGreylist():
|
if not adher.contourneGreylist():
|
||||||
|
|
|
@ -146,11 +146,15 @@ for item in tasks_to_treat:
|
||||||
if db_query['adherent']:
|
if db_query['adherent']:
|
||||||
target = db_query['adherent'][0]
|
target = db_query['adherent'][0]
|
||||||
full_name = target.prenom() + u" " + target.nom()
|
full_name = target.prenom() + u" " + target.nom()
|
||||||
send_to = [ target.mail() + u"@crans.org" ]
|
if not '@' in target.mail():
|
||||||
|
mail = target.mail() + '@crans.org'
|
||||||
|
else:
|
||||||
|
mail = target.mail()
|
||||||
|
send_to = [ mail ]
|
||||||
else:
|
else:
|
||||||
target = db_query['club'][0]
|
target = db_query['club'][0]
|
||||||
full_name = u"Club " + target.nom()
|
full_name = u"Club " + target.nom()
|
||||||
send_to = map(lambda aid : db.search("aid=" + aid)['adherent'][0].mail() + u"@crans.org", target.imprimeurs())
|
send_to = map(lambda aid : db.search("aid=" + aid)['adherent'][0].mail(), target.imprimeurs())
|
||||||
historique = target.historique()
|
historique = target.historique()
|
||||||
historique.reverse() # Ce qu'on cherche a des chances d'être récent et donc d'être à la fin de l'historique.
|
historique.reverse() # Ce qu'on cherche a des chances d'être récent et donc d'être à la fin de l'historique.
|
||||||
file_dirname = files_directory + user + r"/"
|
file_dirname = files_directory + user + r"/"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue