Sha256: 57d4884787cd41dd5fdca7732e85ca7bc5b82befdeaf869d84088a47d2123975

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

module Emailbutler
  class UiController < Emailbutler::ApplicationController
    http_basic_authenticate_with name: Emailbutler.configuration.ui_username,
                                 password: Emailbutler.configuration.ui_password,
                                 if: -> { basic_auth_enabled? }

    private

    def basic_auth_enabled?
      configuration = Emailbutler.configuration

      return false if configuration.ui_username.blank?
      return false if configuration.ui_password.blank?

      configuration.ui_secured_environments.include?(Rails.env)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
emailbutler-0.3.0 app/controllers/emailbutler/ui_controller.rb