Class: Devise::Strategies::CustomAuthenticatable

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

Overview

Strategy for delegating 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
# File 'lib/devise/strategies/custom_authenticatable.rb', line 7

def authenticate!
  resource  = valid_password? && mapping.to.find_for_authentication(authentication_hash)
  return pass unless resource.respond_to?(:valid_for_custom_authentication?)

  catch(:skip_custom_strategies) do
    if validate(resource){ resource.valid_for_custom_authentication?(password) }
      resource.after_custom_authentication
      success!(resource)
    end
  end
end