Class: Devise::Strategies::TokenAuthenticatable

Inherits:
Authenticatable
  • Object
show all
Defined in:
lib/tiddle/strategy.rb

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tiddle/strategy.rb', line 7

def authenticate!
  env["devise.skip_trackable"] = true

  resource = mapping.to.find_for_authentication(email: email_from_headers)
  return fail(:invalid_token) unless resource

  resource.authentication_tokens.each do |token|
    if Devise.secure_compare(token.body, token_from_headers)
      touch_token(token)
      return success!(resource)
    end
  end

  fail(:invalid_token)
end

#store?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/tiddle/strategy.rb', line 27

def store?
  false
end

#valid?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/tiddle/strategy.rb', line 23

def valid?
  email_from_headers.present? && token_from_headers.present?
end