修复: oauth2 token 私有仓库无法获取用户信息
This commit is contained in:
parent
4c7498a046
commit
221c439a1d
|
@ -170,10 +170,6 @@ class ApplicationController < ActionController::Base
|
|||
# 未授权的捕捉407,弹试用申请弹框
|
||||
def require_login
|
||||
#6.13 -hs
|
||||
if request.headers["Authorization"].present?
|
||||
tip_exception(401, "请登录后再操作!") unless valid_doorkeeper_token?
|
||||
User.current = User.find_by(id: @doorkeeper_token.resource_owner_id) if @doorkeeper_token.present?
|
||||
end
|
||||
tip_exception(401, "请登录后再操作") unless User.current.logged?
|
||||
end
|
||||
|
||||
|
@ -252,6 +248,10 @@ class ApplicationController < ActionController::Base
|
|||
#return if params[:controller] == "main"
|
||||
# Find the current user
|
||||
#Rails.logger.info("current_laboratory is #{current_laboratory} domain is #{request.subdomain}")
|
||||
if request.headers["Authorization"].present?
|
||||
tip_exception(401, "请登录后再操作!") unless valid_doorkeeper_token?
|
||||
User.current = User.find_by(id: @doorkeeper_token.resource_owner_id) if @doorkeeper_token.present?
|
||||
else
|
||||
User.current = find_current_user
|
||||
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
|
||||
|
||||
|
@ -290,6 +290,7 @@ class ApplicationController < ActionController::Base
|
|||
cookies.signed[:user_id] = user.id
|
||||
end
|
||||
end
|
||||
end
|
||||
# User.current = User.find 81403
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue