Exemple #1
0
def verify_password(email, password):
    db = get_database()
    try:
        user = User(db.users.find_one({'email': email}))
        if not user or not user.check_password(password):
            return False
        else:
            g.user = user
            return True
    except TypeError:
        return False
Exemple #2
0
 def test_password_hashing(self):
     user = User(username='******')
     user.set_password('dog')
     self.assertFalse(user.check_password('cat'))
     self.assertTrue(user.check_password('dog'))