cschiewek / devise_ldap_authenticatable

Devise Module for LDAP
MIT License
594 stars 359 forks source link

Issue with authenticating #244

Open JonathanFrias opened 6 years ago

JonathanFrias commented 6 years ago

I had an issue authenticating even though my credentials were correct. I have currently solved the problem for myself by changing the following code located at: lib/devise_ldap_authenticatable/ldap/connection.rb:80

      def authenticate!
        return false unless (@password.present? || @allow_unauthenticated_bind)
        @ldap.auth(dn, @password)
        @ldap.bind
        valid_login? # <== I added this line
      end

It seems like we can enter a case where we set our credentials and bind AFTER we have already done our user search. That doesn't seem to make any sense, unless I am doing something wrong ??

Let me know if I can open a PR for this, would love to contribute!