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
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
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