Sha256: 4eab087dfc4d36ff690a0fb5494e827eff5f039452ffc9e59e6851e6b56e4301

Contents?: true

Size: 822 Bytes

Versions: 6

Compression:

Stored size: 822 Bytes

Contents

module ComfortableMexicanSofa::AccessControl
  module AdminAuthentication
    # Set username and password in config/initializers/comfortable_mexican_sofa.rb
    # Like this:
    #   ComfortableMexicanSofa::AccessControl::AdminAuthentication.username = 'myname'
    #   ComfortableMexicanSofa::AccessControl::AdminAuthentication.password = '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.11 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.2 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.1 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.0 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-1.12.10 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-1.12.9 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb