コード例 #1
0
 def check_password(email: str, password: str):
     existing_user = UserRepository.get_by_email(email)
     if not existing_user:
         return None
     if User.check_password(existing_user, password):
         return existing_user
     return None
コード例 #2
0
def test_init():
    from src.models.user import User
    u = User('testy', '*****@*****.**', 'password', 'en')
    assert u.name is 'testy'
    assert u.email is '*****@*****.**'
    assert u.password is not None
    assert u.password is not 'password'
    assert u.check_password('password')
    assert u.lang is 'en'
    assert not u.verified_email
    assert len(u.verification_code) == 50