Module: DeviseToken::Concerns::AuthenticateToken

Extended by:
ActiveSupport::Concern
Includes:
Authenticable, DeviseToken::Controllers::Helpers
Included in:
ApplicationController
Defined in:
app/controllers/devise_token/concerns/authenticate_token.rb

Instance Method Summary collapse

Methods included from Authenticable

#auth_token_request, #auth_token_response, #authenticate_auth, #token

Methods included from DeviseToken::Controllers::Helpers

define_helpers

Instance Method Details

#find_resource(field, value) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'app/controllers/devise_token/concerns/authenticate_token.rb', line 18

def find_resource(field, value)
  # fix for mysql default case insensitivity
  q = "#{field.to_s} = ? AND provider='#{provider.to_s}'"
  if ActiveRecord::Base.connection.adapter_name.downcase.starts_with? 'mysql'
    q = "BINARY " + q
  end

  @resource = resource_class.where(q, value).first
end

#get_case_insensitive_field_from_resource_params(field) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/controllers/devise_token/concerns/authenticate_token.rb', line 8

def get_case_insensitive_field_from_resource_params(field)
  # honor Devise configuration for case_insensitive keys
  q_value = resource_params[field.to_sym]

  if resource_class.case_insensitive_keys.include?(field.to_sym)
    q_value.downcase!
  end
  q_value
end

#providerObject



38
39
40
# File 'app/controllers/devise_token/concerns/authenticate_token.rb', line 38

def provider
  'email'
end