server/utils.py
branchstable
changeset 8550 63260486de89
parent 8546 3d2038d6f20d
child 8696 0bb18407c053
equal deleted inserted replaced
8548:eeabc752c32e 8550:63260486de89
    62     if salt is None:
    62     if salt is None:
    63         return _CRYPTO_CTX.encrypt(passwd)
    63         return _CRYPTO_CTX.encrypt(passwd)
    64     # empty hash, accept any password for backwards compat
    64     # empty hash, accept any password for backwards compat
    65     if salt == '':
    65     if salt == '':
    66         return salt
    66         return salt
    67     if _CRYPTO_CTX.verify(passwd, salt):
    67     try:
    68         return salt
    68         if _CRYPTO_CTX.verify(passwd, salt):
       
    69             return salt
       
    70     except ValueError: # e.g. couldn't identify hash
       
    71         pass
    69     # wrong password
    72     # wrong password
    70     return ''
    73     return ''
    71 
    74 
    72 def cartesian_product(seqin):
    75 def cartesian_product(seqin):
    73     """returns a generator which returns the cartesian product of `seqin`
    76     """returns a generator which returns the cartesian product of `seqin`