Class: Devise::Strategies::TokenAuthenticatable

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

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



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

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)


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

def store?
  false
end

#valid?Boolean

Returns:

  • (Boolean)


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

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