Class: Devise::Strategies::DatabaseAuthenticatable

Inherits:
Authenticatable
  • Object
show all
Defined in:
lib/devise/strategies/database_authenticatable.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authentication_hashObject Originally defined in class Authenticatable

Returns the value of attribute authentication_hash

#authentication_typeObject Originally defined in class Authenticatable

Returns the value of attribute authentication_type

#passwordObject Originally defined in class Authenticatable

Returns the value of attribute password

Instance Method Details

#authenticate!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/devise/strategies/database_authenticatable.rb', line 7

def authenticate!
  resource  = valid_password? && mapping.to.find_for_database_authentication(authentication_hash)
  encrypted = false

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

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