Comme passlib est un peu stupide, le binding va lui mâcher le boulot
This commit is contained in:
parent
3c904e86c1
commit
583bd3d73c
1 changed files with 13 additions and 0 deletions
13
attributs.py
13
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<method>[a-zA-Z]+)}(?P<hash>.*)')
|
||||
|
||||
#: 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__ = ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue