Sha256: 97cb14cd4fbfdf0b39dbd37ba9e5e7cfae9be50b3a95a17d741c6a8d74dae33e

Contents?: true

Size: 838 Bytes

Versions: 12

Compression:

Stored size: 838 Bytes

Contents

require 'devise/strategies/authenticatable'

module Devise
  module Strategies
    # Default strategy for signing in a user, based on their email and password in the database.
    class DatabaseAuthenticatable < Authenticatable
      def authenticate!
        resource  = password.present? && mapping.to.find_for_database_authentication(authentication_hash)
        hashed = false

        if validate(resource){ hashed = true; resource.valid_password?(password) }
          remember_me(resource)
          resource.after_database_authentication
          success!(resource)
        end

        mapping.to.new.password = password if !hashed && Devise.paranoid
        fail(:not_found_in_database) unless resource
      end
    end
  end
end

Warden::Strategies.add(:database_authenticatable, Devise::Strategies::DatabaseAuthenticatable)

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
devise-4.3.0 lib/devise/strategies/database_authenticatable.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/devise-4.2.1/lib/devise/strategies/database_authenticatable.rb
devise-4.2.1 lib/devise/strategies/database_authenticatable.rb
devise-4.2.0 lib/devise/strategies/database_authenticatable.rb
devise-4.0.3 lib/devise/strategies/database_authenticatable.rb
devise-4.1.1 lib/devise/strategies/database_authenticatable.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/devise-4.1.0/lib/devise/strategies/database_authenticatable.rb
devise-4.1.0 lib/devise/strategies/database_authenticatable.rb
devise-4.0.2 lib/devise/strategies/database_authenticatable.rb
devise-4.0.1 lib/devise/strategies/database_authenticatable.rb
devise-4.0.0 lib/devise/strategies/database_authenticatable.rb
devise-4.0.0.rc2 lib/devise/strategies/database_authenticatable.rb