2014-03-18 07:25:49 -04:00
|
|
|
class PasswordsController < Devise::PasswordsController
|
|
|
|
|
|
|
|
def create
|
|
|
|
email = resource_params[:email]
|
|
|
|
resource_found = resource_class.find_by_email(email)
|
|
|
|
if resource_found && resource_found.ldap_user?
|
|
|
|
flash[:alert] = "Cannot reset password for LDAP user."
|
2015-01-23 20:41:10 -05:00
|
|
|
respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name)) and return
|
2014-03-18 07:25:49 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
self.resource = resource_class.send_reset_password_instructions(resource_params)
|
|
|
|
if successfully_sent?(resource)
|
2015-01-23 20:41:10 -05:00
|
|
|
respond_with({}, location: after_sending_reset_password_instructions_path_for(resource_name))
|
2014-03-18 07:25:49 -04:00
|
|
|
else
|
|
|
|
respond_with(resource)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|