diff options
author | Starfall <root@starfall.blue> | 2020-02-04 17:44:29 -0600 |
---|---|---|
committer | Starfall <root@starfall.blue> | 2020-02-04 17:44:29 -0600 |
commit | 6d24d3bcb84abd04f31da95f97f6d60ef0afdc00 (patch) | |
tree | e7c38251a9e92bdf3a464b4aa7f1880aa5139bf0 /config/initializers/doorkeeper.rb | |
parent | c0c9529df269816f52915a9802e5e30fbce9576b (diff) | |
parent | 885e9227c6e8e1ce5e4a5625d5126ba76dce2c00 (diff) |
Merge branch 'glitch'
Diffstat (limited to 'config/initializers/doorkeeper.rb')
-rw-r--r-- | config/initializers/doorkeeper.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 7784bec62..e03380cec 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -8,20 +8,15 @@ Doorkeeper.configure do end resource_owner_from_credentials do |_routes| - if Devise.ldap_authentication - user = User.authenticate_with_ldap({ :email => request.params[:username], :password => request.params[:password] }) - end - - if Devise.pam_authentication - user ||= User.authenticate_with_ldap({ :email => request.params[:username], :password => request.params[:password] }) - end + user = User.authenticate_with_ldap(email: request.params[:username], password: request.params[:password]) if Devise.ldap_authentication + user ||= User.authenticate_with_pam(email: request.params[:username], password: request.params[:password]) if Devise.pam_authentication if user.nil? user = User.find_by(email: request.params[:username]) - user = nil unless user.valid_password?(request.params[:password]) + user = nil unless user&.valid_password?(request.params[:password]) end - user if !user&.otp_required_for_login? + user unless user&.otp_required_for_login? end # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below. |