Sha256: 3670c07cbf718fcfef79018dcb0c8853222c3c46800b1e80e657611d6b2e2d1a

Contents?: true

Size: 719 Bytes

Versions: 5

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true

module Masks
  # @visibility private
  class ApplicationController < ActionController::Base
    include Masks::Controller
    include Pagy::Backend

    before_action :assign_session

    skip_before_action :verify_authenticity_token, if: :json_request?

    protect_from_forgery with: :exception

    private

    def json_request?
      request.format.symbol == :json
    end

    def assign_session
      @session = masked_session
      @config = @session.config
      @actor = @session.actor
    end

    def require_sudo(redirect)
      return if current_mask.type == "sudo" && passed?

      flash[:errors] = ["enter a valid password"]

      redirect_to redirect
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masks-0.4.0 app/controllers/masks/application_controller.rb
masks-0.3.2 app/controllers/masks/application_controller.rb
masks-0.3.1 app/controllers/masks/application_controller.rb
masks-0.3.0 app/controllers/masks/application_controller.rb
masks-0.2.0 app/controllers/masks/application_controller.rb