Sha256: bfdf89fcb03bad7051b249cc32d59a2eca1367597acf71ba2e6f619ad7d98246

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

module Maily
  class ApplicationController < Maily.base_controller.constantize
    before_filter :maily_enabled?, :http_authorization

    layout 'maily/application'

    private

    def maily_enabled?
      Maily.enabled || raise('Maily: engine disabled!')
    end

    def http_authorization
      if auth_hash = Maily.http_authorization
        authenticate_or_request_with_http_basic do |username, password|
          username == auth_hash[:username] && password == auth_hash[:password]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
maily-0.5.0 app/controllers/maily/application_controller.rb
maily-0.4.0 app/controllers/maily/application_controller.rb