Sha256: 1c02af5b6714c3024b11d2f34bfe164d98a229c6cd4926ddd5f24b2d2c7b7b28

Contents?: true

Size: 669 Bytes

Versions: 14

Compression:

Stored size: 669 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
      # @resource will have been set by set_user_token concern
      if @resource
        render json: {
          success: true,
          data: @resource.as_json(except: [
            :tokens, :created_at, :updated_at
          ])
        }
      else
        render json: {
          success: false,
          errors: ["Invalid login credentials"]
        }, status: 401
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
cm-devise_token_auth-0.1.30.1 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta9 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta8 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta7 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta6 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta5 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta4 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta3 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta2 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.31.beta1 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.30 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.30.beta6 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.30.beta5 app/controllers/devise_token_auth/token_validations_controller.rb
devise_token_auth-0.1.30.beta4 app/controllers/devise_token_auth/token_validations_controller.rb