Sha256: 8045a21c4922d65d27ce04605e639d1c003539e3c57f895b65071e461440e331

Contents?: true

Size: 682 Bytes

Versions: 2

Compression:

Stored size: 682 Bytes

Contents

require 'simple_token_authentication/entity'

module DeviseIosRails
  class PasswordsController < Devise::PasswordsController
    include SimpleTokenAuthentication::TokenAuthenticationHandler

    def update
      respond_to do |format|
        format.html { super }
        format.json do
          super and return if authenticate_entity_from_token!(entity).nil?

          user = DeviseIosRails::ChangePasswordService.new(
            send("current_#{resource_name}"),
            params[:user]
          ).call!

          respond_with user
        end
      end
    end

    private

    def entity
      SimpleTokenAuthentication::Entity.new(resource_class)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
devise-ios-rails-1.0.1 app/controllers/devise_ios_rails/passwords_controller.rb
devise-ios-rails-1.0.0 app/controllers/devise_ios_rails/passwords_controller.rb