Bundle of corrections and one doorkeeper writing role change

This commit is contained in:
Fosco Marotto
2021-02-09 22:32:24 -05:00
parent 382fd31ec7
commit 729c00a5a9
12 changed files with 18 additions and 45 deletions

View File

@@ -20,7 +20,7 @@ development:
encoding: unicode
slave2:
adapter: postgresql
url: <%= ENV['DB_SLAVE1_URL'] %>
url: <%= ENV['DB_SLAVE2_URL'] %>
pool: <%= ENV['DB_POOL'] %>
timeout: 5000
encoding: unicode
@@ -69,4 +69,4 @@ production:
pool: <%= ENV['DB_POOL'] %>
timeout: 5000
encoding: unicode

View File

@@ -8,8 +8,10 @@ Doorkeeper.configure do
end
resource_owner_from_credentials do |_routes|
user = User.find_by(email: request.params[:username])
user if !user&.otp_required_for_login? && user&.valid_password?(request.params[:password])
ActiveRecord::Base.connected_to(role: :writing) do
user = User.find_by(email: request.params[:username])
user if !user&.otp_required_for_login? && user&.valid_password?(request.params[:password])
end
end
# If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.