Esempio n. 1
0
 def findHash(self, password):
   'Find a hash given the password'
   # Look for an existing hash
   for hash in self.getHashes():
     if hash[:4] == '$2a$' and checkHash(password, hash):
       return hash
   return None
Esempio n. 2
0
 def getPassword(self, password):
     passwords = self.db.lrange("passwords-%s" % self.username, 0, -1)
     for index in range(len(passwords)):
         if checkHash(password=password, hash=passwords[index]):
             return UserPassword(self.db, self.username, passwords[index])
     return None
Esempio n. 3
0
 def getPassword(self, password):
     passwords = self.db.lrange('passwords-%s' % self.username, 0, -1)
     for index in range(len(passwords)):
         if checkHash(password=password, hash=passwords[index]):
             return UserPassword(self.db, self.username, passwords[index])
     return None