diff options
author | beatrix <beatrix.bitrot@gmail.com> | 2017-09-28 21:48:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-28 21:48:28 -0400 |
commit | c027a7bd4d7b5af21f4b201d656f7251fa3606a1 (patch) | |
tree | ce2c2327b26358c26cb899ea918988af373ca6d6 /config/initializers/doorkeeper.rb | |
parent | 210e6776fce016666ecfd248b2208c487f3440f9 (diff) | |
parent | 53f829dfa8bc376041a442dc84c22aa1cbfcb9d0 (diff) |
Merge pull request #157 from glitch-soc/merging-upstream
ABRACA-HRRRRRRRRRRRNGGGGGGGHHH!!!!!!!!!!!!!!!!!!!
Diffstat (limited to 'config/initializers/doorkeeper.rb')
-rw-r--r-- | config/initializers/doorkeeper.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 689e2ac4a..074f8c410 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -7,15 +7,14 @@ Doorkeeper.configure do current_user || redirect_to(new_user_session_url) end - resource_owner_from_credentials do |routes| - request.params[:user] = { email: request.params[:username], password: request.params[:password] } - request.env["devise.allow_params_authentication"] = true - request.env["warden"].authenticate!(scope: :user) + 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]) end # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below. admin_authenticator do - (current_user && current_user.admin?) || redirect_to(new_user_session_url) + current_user&.admin? || redirect_to(new_user_session_url) end # Authorization Code expiration time (default 10 minutes). |