Пример #1
0
 def set_password(self, raw_passwd):
     """Generates bcrypt hash and salt for storing a user's password. With
     bcrypt, the salt is kind of redundant, but this format stays friendly
     to other algorithms.
     """
     (algorithm, salt, digest) = auth.gen_hexdigest(raw_passwd)
     self.password = auth.build_passwd_line(algorithm, salt, digest)
Пример #2
0
 def set_password(self, raw_passwd):
     """Generates bcrypt hash and salt for storing a user's password. With
     bcrypt, the salt is kind of redundant, but this format stays friendly
     to other algorithms.
     """
     (algorithm, salt, digest) = auth.gen_hexdigest(raw_passwd)
     self.password = auth.build_passwd_line(algorithm, salt, digest)
Пример #3
0
 def check_password(self, raw_password):
     """Compares raw_password to password stored for user. Updates
     self.last_login on success.
     """
     algorithm, salt, hash = auth.split_passwd_line(self.password)
     (_, _, user_hash) = auth.gen_hexdigest(raw_password, algorithm=algorithm, salt=salt)
     if hash == user_hash:
         self.last_login = curtime()
         return True
     else:
         return False
Пример #4
0
 def check_password(self, raw_password):
     """Compares raw_password to password stored for user. Updates
     self.last_login on success.
     """
     algorithm, salt, hash = auth.split_passwd_line(self.password)
     (_, _, user_hash) = auth.gen_hexdigest(raw_password,
                                            algorithm=algorithm,
                                            salt=salt)
     if hash == user_hash:
         self.last_login = curtime()
         return True
     else:
         return False