Browse Source

auth token 接入验证登录接口

pull/313/head
xiaoxiaoqiong 4 years ago
parent
commit
d97888ad16
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      app/controllers/application_controller.rb

+ 2
- 2
app/controllers/application_controller.rb View File

@@ -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



Loading…
Cancel
Save