This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/controllers/desktop/registrations_controller.rb

16 lines
632 B
Ruby

class Desktop::RegistrationsController < Devise::RegistrationsController
def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
if resource.update_with_password(params[resource_name])
set_flash_message :notice, :updated if is_navigational_format?
sign_in resource_name, resource, :bypass => true
render json: {success:true, msg: "Password successfully update!"}.to_json
else
clean_up_passwords(resource)
error_msg = resource.errors.full_messages.join("<br />")
render :json => {success: false, msg: error_msg}.to_json
end
end
end