Sha256: 9d66a371299de25948460258db3fb8e325dfd6b39a30a0b386181439bdd64128

Contents?: true

Size: 823 Bytes

Versions: 10

Compression:

Stored size: 823 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

10 entries across 10 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-2.0.12 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.11 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.10 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.9 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.8 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.7 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.6 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.5 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.4 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb
comfortable_mexican_sofa-2.0.3 lib/comfortable_mexican_sofa/access_control/admin_authentication.rb