From d97888ad16b7800228ea9e8e6972ff0114bcaa72 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Tue, 28 Jun 2022 10:02:39 +0800 Subject: [PATCH] =?UTF-8?q?auth=20token=20=E6=8E=A5=E5=85=A5=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=99=BB=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 986f41e75..eba648482 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -170,8 +170,8 @@ class ApplicationController < ActionController::Base # 未授权的捕捉407,弹试用申请弹框 def require_login #6.13 -hs - tip_exception(401, "请登录后再操作") unless valid_doorkeeper_token? - User.current = User.find_by(id: @doorkeeper_token.resource_owner_id) + tip_exception(401, "请登录后再操作") unless request.headers["Authorization"] && valid_doorkeeper_token? + User.current = User.find_by(id: @doorkeeper_token.resource_owner_id) if @doorkeeper_token.present? tip_exception(401, "请登录后再操作") unless User.current.logged? end