diff --git a/attributs.py b/attributs.py index d1f1dbf..ed0652d 100644 --- a/attributs.py +++ b/attributs.py @@ -57,6 +57,9 @@ import cranslib.deprecated from gestion import config from gestion import annuaires_pg +#: Format d'un hash de mdp ldap +HASH_RE = re.compile(r'{(?P[a-zA-Z]+)}(?P.*)') + #: Serveur SMTP smtpserv = "smtp.crans.org" @@ -1508,6 +1511,16 @@ class userPassword(rightProtectedAttr): can_modify = [nounou, bureau, cableur, soi] historique = "info" + def __unicode__(self): + """On met en MAJUSCULES le mot clef qui indique le + type de hashage, car sinon passlib est trop con pour + comprendre""" + + matched = HASH_RE.match(self.value) + groupdict = {}.update(matched.groupdict()) + groupdict['method'] = groupdict['method'].upper() + return unicode("{%(method)s}%(hash)s" % groupdict) + @crans_attribute class sshFingerprint(Attr): __slots__ = ()