cschiewek / devise_ldap_authenticatable

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

Gem overrides deprecated reset_password!, not active reset_password #217

Open leonsp opened 8 years ago

leonsp commented 8 years ago

The current Devise password reset process does not work in devise_ldap_authenticatable because Devise now uses reset_password but devise_ldap_authenticatable only overrides reset_password!

As an end user, I can work around by adding this to my user model:

    def reset_password(new_password, new_password_confirmation)
      if new_password == new_password_confirmation && ::Devise.ldap_update_password
        Devise::LDAP::Adapter.update_password(login_with, new_password)
      end
      clear_reset_password_token if valid?
      save
    end
w-A-L-L-e commented 5 years ago

Thanks this helped me out. Doing this seems shorter/future proof (until the actual fix is in as reset_password! method might have changed between your post in 2015 and now ;) ):

def reset_password(new_password, new_password_confirmation)
    reset_password!(new_password, new_password_confirmation)
 end

This makes the password forget functional again but on my setup however the ldap password is not yet actually changed (it does create a session + logs in properly after giving pass+confirmation with above fix but when doing a logout/login only the old password works). In server logs I see LDAP Error 32: No such object so I'll need to investigate further to get this working completely.

raucao commented 3 years ago

Just FYI: This is still the case, and the fixes still work.

For me, it also updates LDAP passwords when resetting them. (I'm using the password builder config to ensure the exact format our setup requires.)