Module: Sorcery::Model::Submodules::RememberMe::InstanceMethods

Defined in:
lib/sorcery/model/submodules/remember_me.rb

Instance Method Summary collapse

Instance Method Details

#forget_me!Object

You shouldn’t really use this one yourself - it’s called by the controller’s ‘forget_me!’ method.



53
54
55
56
57
# File 'lib/sorcery/model/submodules/remember_me.rb', line 53

def forget_me!
  config = sorcery_config
  self.sorcery_adapter.update_attributes(config.remember_me_token_attribute_name => nil,
                              config.remember_me_token_expires_at_attribute_name => nil)
end

#has_remember_me_token?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/sorcery/model/submodules/remember_me.rb', line 48

def has_remember_me_token?
  self.send(sorcery_config.remember_me_token_attribute_name).present?
end

#remember_me!Object

You shouldn’t really use this one yourself - it’s called by the controller’s ‘remember_me!’ method.



42
43
44
45
46
# File 'lib/sorcery/model/submodules/remember_me.rb', line 42

def remember_me!
  config = sorcery_config
  self.sorcery_adapter.update_attributes(config.remember_me_token_attribute_name => TemporaryToken.generate_random_token,
                              config.remember_me_token_expires_at_attribute_name => Time.now.in_time_zone + config.remember_me_for)
end