def authenticate_user(username, password):
    """
    Authenticate a username and password against our database
    :param username:
    :param password:
    :return: authenticated username
    """
    user_model = Query()
    user = db.get(user_model.username == username)

    if not user:
        logger.warning("User %s not found", username)
        return False

    if user['password'] == hash_password(password, user.get('salt')):
        return user['username']

    return False
def authenticate_user ( username , password ) : user_model = Query ( ) user = db . get ( user_model . username == username ) if not user : logger . warning ( "User %s not found" , username ) return False if user [ 'password' ] == hash_password ( password , user . get ( 'salt' ) ) : return user [ 'username' ] return False
Authenticate a username and password against our database
    :param username:
    :param password:
    :return: authenticated username