Sha256: f654dc0cfef8bec7a83d65ff81a8a8d6c3acef1f1911acd06a797be49aa3943b

Contents?: true

Size: 977 Bytes

Versions: 5

Compression:

Stored size: 977 Bytes

Contents

class ApplicationController < ActionController::Base
  include MVP::AnalyticsConcern
  include MVP::SEOConcern
  include MVP::SessionConcern

  helper MVP::Engine.helpers

  before_action :authenticate_with_http_basic if ENV['HTTP_BASIC_AUTH_USER']
  
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception

  class RecordNotFound < StandardError; end

  if Rails.env.production?
    rescue_from StandardError do |exception|
      Rollbar.error(exception)
      render 'errors/internal_server_error', status: 500
    end

    rescue_from RecordNotFound, Neo4j::ActiveNode::Labels::RecordNotFound do |exception|
      render 'errors/not_found', status: 404
    end
  end

  def authenticate_with_http_basic
    authenticate_or_request_with_http_basic do |username, password|
      username == ENV['HTTP_BASIC_AUTH_USER'] && password == ENV['HTTP_BASIC_AUTH_PASSWORD']
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mvpkit-1.0.4 project/app/controllers/application_controller.rb
mvpkit-1.0.3 project/app/controllers/application_controller.rb
mvpkit-1.0.2 project/app/controllers/application_controller.rb
mvpkit-1.0.1 project/app/controllers/application_controller.rb
mvpkit-1.0.0 project/app/controllers/application_controller.rb