修复: oauth2 验证统一改为application控制器里的user_setup

This commit is contained in:
2022-07-11 18:50:13 +08:00
parent 915e689ef9
commit d7a970e7d5
2 changed files with 16 additions and 13 deletions

View File

@@ -1,6 +1,7 @@
# frozen_string_literal: true
Doorkeeper.configure do
base_controller 'ApplicationController'
# Change the ORM that doorkeeper will use (requires ORM extensions installed).
# Check the list of supported ORMs here: https://github.com/doorkeeper-gem/doorkeeper#orms
orm :active_record
@@ -20,7 +21,7 @@ Doorkeeper.configure do
access_token_generator '::Doorkeeper::JWT'
admin_authenticator do
user = User.find_by_id(session[:www_user_id])
user = current_user
unless user && user.admin_or_business?
redirect_to root_url
end