forked from fedi/mastodon
Fix resource_owner_from_credentials in Doorkeeper initializer (#12743)
- Nil error when e-mail not found - LDAP authentication used in place of PAM authentication
This commit is contained in:
parent
4729341903
commit
59c697a30c
|
@ -8,20 +8,15 @@ Doorkeeper.configure do
|
||||||
end
|
end
|
||||||
|
|
||||||
resource_owner_from_credentials do |_routes|
|
resource_owner_from_credentials do |_routes|
|
||||||
if Devise.ldap_authentication
|
user = User.authenticate_with_ldap(email: request.params[:username], password: request.params[:password]) if Devise.ldap_authentication
|
||||||
user = User.authenticate_with_ldap({ :email => request.params[:username], :password => request.params[:password] })
|
user ||= User.authenticate_with_pam(email: request.params[:username], password: request.params[:password]) if Devise.pam_authentication
|
||||||
end
|
|
||||||
|
|
||||||
if Devise.pam_authentication
|
|
||||||
user ||= User.authenticate_with_ldap({ :email => request.params[:username], :password => request.params[:password] })
|
|
||||||
end
|
|
||||||
|
|
||||||
if user.nil?
|
if user.nil?
|
||||||
user = User.find_by(email: request.params[:username])
|
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
|
end
|
||||||
|
|
||||||
user if !user&.otp_required_for_login?
|
user unless user&.otp_required_for_login?
|
||||||
end
|
end
|
||||||
|
|
||||||
# If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
|
# If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
|
||||||
|
|
Loading…
Reference in a new issue