bloque l'injection de comptes sans email
This commit is contained in:
parent
8b8a52d2fb
commit
ba02764716
|
@ -124,8 +124,10 @@ class ProfilRechercheAuthentification(ProfilMoteurAuthentification):
|
|||
def creation_du_compte(self, identifiant, cas_url, ldap_resultat):
|
||||
'''Création de compte depuis le LDAP
|
||||
'''
|
||||
return self.profil_classe.new_cas_user(identifiant,
|
||||
(ldap_resultat[0][1].get(self.MAIL) or [''])[0], cas_url)
|
||||
email = ldap_resultat[0][1].get(self.MAIL)
|
||||
email |= ldap_resultat[0][1].get(self.SUPANN_MAIL_PERSO)
|
||||
email |= ''
|
||||
return self.profil_classe.new_cas_user(identifiant, email, cas_url)
|
||||
|
||||
def creation_automatique_du_compte(self, identifiant, cas_url, ldap_resultat):
|
||||
'''Si le compte LDAP pour l'identifiant CAS identifiant est un compte d'étudiant,
|
||||
|
|
|
@ -384,6 +384,13 @@ class InjectionProfilRechercheForm(Form):
|
|||
ldap_resultats = []
|
||||
for compte in comptes:
|
||||
ldap_resultat = backend.recherche_utilisateur(compte)
|
||||
attributes = ldap_resultat[0][1]
|
||||
if ProfilRechercheAuthentification.MAIL in attributes:
|
||||
pass
|
||||
elif ProfilRechercheAuthentification.SUPANN_MAIL_PERSO in attributes:
|
||||
pass
|
||||
else:
|
||||
raise forms.ValidationError(_(u"L'utilisateur %s n'a pas d'email.") % compte)
|
||||
if not ldap_resultat:
|
||||
errors.append(compte)
|
||||
else:
|
||||
|
|
Reference in New Issue