Sha256: 3187072975f08d729c24a1cee3a8475895201c81ca3026451cdf34eb9a6a7c0d

Contents?: true

Size: 655 Bytes

Versions: 3

Compression:

Stored size: 655 Bytes

Contents

module ComfyPress::HttpAuth
  # Set username and password in config/initializers/comfypress.rb
  # Like this:
  #   ComfyPress::HttpAuth.username = 'myname'
  #   ComfyPress::HttpAuth.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|
      username == self.username && password == self.password
    end
  end
  
end

Version data entries

3 entries across 2 versions & 1 rubygems

Version Path
comfypress-0.1.4 db/lib/comfypress/authentication/http_auth.rb
comfypress-0.1.4 lib/comfypress/authentication/http_auth.rb
comfypress-0.1.3 lib/comfypress/authentication/http_auth.rb