Sha256: 8b9e53787be5169d4afdfcd5b397c94a15f06e8bfa1cd6f8f68def7420ece779

Contents?: true

Size: 647 Bytes

Versions: 13

Compression:

Stored size: 647 Bytes

Contents

class Api::V1::ApiController < ::ActionController::API

  before_action :authenticate_user

  private

    def authenticate_user
      #["current_user","current_token"] Make this true to check for email also
      @instance_hash = ::Arcadex.full_authentication(params,request,false)
      if @instance_hash.nil?
        render :json => {errors: "User is not logged in, register or log in"} , status: :unauthorized
      end
    end

    def current_user
    	if !@instance_hash.nil?
    		@instance_hash["current_user"]
    	end
    end

    def current_token
    	if !@instance_hash.nil?
    		@instance_hash["current_token"]
    	end
    end
end

Version data entries

13 entries across 8 versions & 1 rubygems

Version Path
json_voorhees-0.3.0 lib/generators/json_voorhees/setup_app/templates/api_controller_with_arcadex.rb
json_voorhees-0.2.3 test/test_app/app/controllers/api/v1/api_controller.rb
json_voorhees-0.2.3 lib/generators/json_voorhees/setup_app/templates/api_controller_with_arcadex.rb
json_voorhees-0.2.2 lib/generators/json_voorhees/setup_app/templates/api_controller_with_arcadex.rb
json_voorhees-0.2.2 test/test_app/app/controllers/api/v1/api_controller.rb
json_voorhees-0.2.1 lib/generators/json_voorhees/setup_app/templates/api_controller_with_arcadex.rb
json_voorhees-0.2.1 test/test_app/app/controllers/api/v1/api_controller.rb
json_voorhees-0.2.0 test/test_app/app/controllers/api/v1/api_controller.rb
json_voorhees-0.2.0 lib/generators/json_voorhees/setup_app/templates/api_controller_with_arcadex.rb
json_voorhees-0.1.0 test/test_app/app/controllers/api/v1/api_controller.rb
json_voorhees-0.1.0 lib/generators/json_voorhees/setup_app/templates/api_controller_with_arcadex.rb
json_voorhees-0.0.2 lib/generators/json_voorhees/setup_app/templates/api_controller_with_arcadex.rb
json_voorhees-0.0.1 lib/generators/json_voorhees/setup_app/templates/api_controller_with_arcadex.rb