Sha256: 3d500d08e8b0b2b9959adf9fb0f40f8e7bcbf9034067380f618aa1b928157110

Contents?: true

Size: 788 Bytes

Versions: 2

Compression:

Stored size: 788 Bytes

Contents

module Trestle
  module Auth
    class Configuration
      extend ActiveSupport::Autoload

      autoload :Rememberable

      include Configurable

      option :user_class, -> { ::Administrator }
      option :user_scope, -> { Trestle.config.auth.user_class }
      option :user_admin

      option :authenticate_with, :email

      option :authenticate, ->(params) {
        scope = Trestle.config.auth.user_scope

        scope.authenticate(
          params[Trestle.config.auth.authenticate_with],
          params[:password]
        )
      }

      option :avatar, ->(user) {
        gravatar(user.email)
      }, evaluate: false

      option :locale, ->(user) {
        user.locale if user.respond_to?(:locale)
      }

      option :remember, Rememberable.new
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trestle-auth-0.2.1 lib/trestle/auth/configuration.rb
trestle-auth-0.2.0 lib/trestle/auth/configuration.rb