Sha256: 28d87896f2d891d3b36acf3bd85268bbb90d5c2adeb0bccf3a315b2a57912a0f

Contents?: true

Size: 420 Bytes

Versions: 2

Compression:

Stored size: 420 Bytes

Contents

module Goldencobra
  class Api::V1::BaseController < ActionController::Base
    respond_to :json, :xml

    before_filter :authenticate_user

    private
      def authenticate_user
        @current_visitor = Visitor.find_by_authentication_token(params[:token])
        unless @current_visitor
          error = { error: "The token is invalid" }
          respond_with(error, status: 401)
        end
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
goldencobra-1.1.0 app/controllers/goldencobra/api/v1/base_controller.rb
goldencobra-1.0.9.3 app/controllers/goldencobra/api/v1/base_controller.rb