Sha256: fb01cd7ee25cb7736c34eec39605bae3581d0df89fdc90ccc7e82f56ad522c94

Contents?: true

Size: 663 Bytes

Versions: 2

Compression:

Stored size: 663 Bytes

Contents

module DeviseTokenAuth
  class TokenValidationsController < DeviseTokenAuth::ApplicationController
    skip_before_filter :assert_is_devise_resource!, :only => [:validate_token]
    before_filter :set_user_by_token, :only => [:validate_token]

    def validate_token
      # @user will have been set by set_user_token concern
      if @user
        render json: resource_serializer(@user)
      else
        render json: error_messages("Invalid login credentials"), status: 401
      end
    end


    def resource_serializer(user)
      serializer = DeviseTokenAuth.token_validation_serializer || ResourceSerializer
      serializer.new(user)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xing_backend_token_auth-0.1.32 app/controllers/devise_token_auth/token_validations_controller.rb
xing_backend_token_auth-0.1.31 app/controllers/devise_token_auth/token_validations_controller.rb