def verify_password_or_token(username_or_token, password): """登录状态校验""" user = User.verify_token(token=username_or_token) if not user: user = User.query.filter(User.account == username_or_token).first() if not user or not user.verify_password(password): return False g.user = user return True