Sha256: d7ad3c26b7ac5db00f6f66a53b556485c752272b24f68c229e36e051d773ab75

Contents?: true

Size: 852 Bytes

Versions: 3

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

module ComfortableMediaSurfer::AccessControl
  module AdminAuthentication
    # Set username and password in config/initializers/comfortable_media_surfer.rb
    # Like this:
    #   ComfortableMediaSurfer::AccessControl::AdminAuthentication.username = 'myname'
    #   ComfortableMediaSurfer::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

3 entries across 3 versions & 1 rubygems

Version Path
comfortable_media_surfer-3.1.1 lib/comfortable_media_surfer/access_control/admin_authentication.rb
comfortable_media_surfer-3.1.0 lib/comfortable_media_surfer/access_control/admin_authentication.rb
comfortable_media_surfer-3.0.0 lib/comfortable_media_surfer/access_control/admin_authentication.rb