From 583bd3d73c5e97ede715ede8df1bd75e61d8008f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Sat, 6 Jun 2015 17:46:34 +0200 Subject: [PATCH] =?UTF-8?q?Comme=20passlib=20est=20un=20peu=20stupide,=20l?= =?UTF-8?q?e=20binding=20va=20lui=20m=C3=A2cher=20le=20boulot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attributs.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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__ = ()