devise_ldap_authenticatable
devise_ldap_authenticatable copied to clipboard
undefined method `update_with_password' for #<User:
hi,
I get the error in the object when I try to update the user password in ldap.
Thanks
Has any progress been made on this?
I get a NoMethodError, for update_with_password.
It comes from a PUT request to "/users/user" (which is more than likely incorrect). It processes the request by Devise::RegistrationsController#Update as HTML
If any progress has been made thus far, I would greatly appreciate it. Or a solution if I should have something wrong on my end.
I was able to "fix" the issue by writing an "update_with_password" method inside my user model.
I don't think it actually authenticates to the user before changing the password, but it actually does update the LDAP server with the correct new password. So far it's a quick hack but I'm not sure why Rails doesn't see the update_with_password method from this Gem.
Anyways, here's my user.rb model should it help @alexberny
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :ldap_authenticatable, :trackable, :rememberable, :registerable
def update_with_password(params)
@new_password = params[:password]
@current_password = params[:current_password]
raise "Need to auth password first" if @current_password.blank?
Devise::LDAP::Adapter.update_own_password(login_with, @new_password, @current_password)
end
end
Running into the same issue.
This gem only provides a class method stub called update_with_password:
module ClassMethods
def update_with_password(resource)
puts "UPDATE_WITH_PASSWORD: #{resource.inspect}"
end
but devise calls it on the resource: https://github.com/plataformatec/devise/blob/6af18ed9e3f2344ac020d51fe6e06a9ee245ee0b/app/controllers/devise/registrations_controller.rb#L99
i would say that this is a bug in devise_ldap_authenticatable.
Just ran into this problem too. I don't even get the 'puts' in devise_ldap_authenticatable/model.rb
undefined method `update_with_password' for ....
Same problem here. Any fix to be expected?
I manage to possibly fix it with workaround, https://github.com/cschiewek/devise_ldap_authenticatable/issues/266