コード例 #1
0
ファイル: models.py プロジェクト: B-Rich/watson-auth
    def password(self, password):
        """Automatically generates the hashed password and salt when set.

        Args:
            string password: The password to set.
        """
        _pass, salt = authentication.generate_password(password)
        self._password = _pass
        self.salt = salt
コード例 #2
0
 def test_generate_password(self):
     password, salt = authentication.generate_password('test', 10)
     assert password
     assert salt
コード例 #3
0
 def test_check_password(self):
     password, salt = authentication.generate_password('test', 10)
     assert authentication.check_password('test', password, salt)
     assert not authentication.check_password('testing', password, salt)