def valid_log_token(username, log_token): if username: username = username.lower() user = User.get_user(username) return user and log_token == user.log_token
def valid_login(username, password): if username: username = username.lower() user = User.get_user(username) if user and bc.hashpw(password, user.password) == user.password: return Authentication.create_and_save_log_token(user)