class Devise::Strategies::DatabaseAuthenticatable

Default strategy for signing in a user, based on their email and password in the database.

Public Instance Methods

authenticate!() click to toggle source
# File lib/devise/strategies/database_authenticatable.rb, line 8
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