Class: Devise::Strategies::CustomAuthenticatable

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

Overview

Strategy for delegateing authentication logic to custom model’s method

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



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

def authenticate!
  resource  = valid_password? && mapping.to.find_for_authentication(authentication_hash)

  unless resource.respond_to?(:valid_for_custom_authentication?)
    return pass
  end

  if validate(resource){ resource.valid_for_custom_authentication?(password) }
    success!(resource)
  else
    pass
  end
end