def verify_password(email_or_token, password):
    if password == '':
        user = userService.verify_auth_token(email_or_token)
        g.token_used = True
        return user is not None
    
    user = userService.get_user_by_email(email_or_token)
    if user is None:
        return False
    else:
        g.token_used = False
        return userService.verify_password(user, password)
def set_current_user():
    auth = request.authorization
    if not auth:
        g.current_user = None
        return

    email_or_token = auth.username
    password = auth.password

    if password == '':
        g.current_user = userService.verify_auth_token(email_or_token)
    else:
        g.current_user = userService.get_user_by_email(email_or_token)