Sha256: 17d0dd7a094993114bbcc6f6a46c4ac33ca98c3bf53257c0a251c8efb839c66a

Contents?: true

Size: 453 Bytes

Versions: 8

Compression:

Stored size: 453 Bytes

Contents

module Trestle
  module Auth
    module ModelMethods
      extend ActiveSupport::Concern

      require_relative "model_methods/rememberable"

      included do
        has_secure_password
      end

      module ClassMethods
        def authenticate(identifier, password)
          user = find_by(Trestle.config.auth.authenticate_with => identifier) || NullUser.new
          user if user.authenticate(password)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
trestle-auth-0.5.0 lib/trestle/auth/model_methods.rb
trestle-auth-0.5.0.pre2 lib/trestle/auth/model_methods.rb
trestle-auth-0.5.0.pre lib/trestle/auth/model_methods.rb
trestle-auth-0.4.4 lib/trestle/auth/model_methods.rb
trestle-auth-0.4.3 lib/trestle/auth/model_methods.rb
trestle-auth-0.4.2 lib/trestle/auth/model_methods.rb
trestle-auth-0.4.1 lib/trestle/auth/model_methods.rb
trestle-auth-0.4.0 lib/trestle/auth/model_methods.rb