Sha256: b3e1b91b5cedf71c201bd8b65f8a2b322f7871c43f88081a71e55df1f936a0af

Contents?: true

Size: 803 Bytes

Versions: 6

Compression:

Stored size: 803 Bytes

Contents

module ComfortableMexicanSofa::AccessControl
  module AdminAuthentication
    # Set username and password in config/initializers/comfortable_mexican_sofa.rb
    # Like this:
    #   ComfortableMexicanSofa::AccessControl::AdminAuthentication = 'myname'
    #   ComfortableMexicanSofa::AccessControl::AdminAuthentication = 'mypassword'

    mattr_accessor  :username,
                    :password

    # Simple http_auth. When implementing some other form of authentication
    # this method should return +true+ if everything is great, or redirect user
    # to some other page, thus denying access to cms admin section.
    def authenticate
      authenticate_or_request_with_http_basic do |username, password|
        self.username == username && self.password == password
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.12.8 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-1.12.7 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-1.12.6 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-1.12.5 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-1.12.4 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-1.12.3 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb