Module: Sorcery::Controller::Submodules::RememberMe::InstanceMethods
- Defined in:
- lib/sorcery/controller/submodules/remember_me.rb
Instance Method Summary collapse
-
#auto_login(user, should_remember = false) ⇒ Object
Override.
-
#force_forget_me! ⇒ Object
Clears the cookie, and clears the token value.
-
#forget_me! ⇒ Object
Clears the cookie, and depending on the value of remember_me_token_persist_globally, may clear the token value.
-
#remember_me! ⇒ Object
This method sets the cookie and calls the user to save the token and the expiration to db.
Instance Method Details
#auto_login(user, should_remember = false) ⇒ Object
Override. logins a user instance, and optionally remembers him.
46 47 48 49 50 |
# File 'lib/sorcery/controller/submodules/remember_me.rb', line 46 def auto_login(user, should_remember = false) session[:user_id] = user.id.to_s @current_user = user remember_me! if should_remember end |
#force_forget_me! ⇒ Object
Clears the cookie, and clears the token value.
39 40 41 42 |
# File 'lib/sorcery/controller/submodules/remember_me.rb', line 39 def force_forget_me! current_user.force_forget_me! .delete(:remember_me_token, domain: Config.) end |
#forget_me! ⇒ Object
Clears the cookie, and depending on the value of remember_me_token_persist_globally, may clear the token value.
33 34 35 36 |
# File 'lib/sorcery/controller/submodules/remember_me.rb', line 33 def forget_me! current_user.forget_me! .delete(:remember_me_token, domain: Config.) end |
#remember_me! ⇒ Object
This method sets the cookie and calls the user to save the token and the expiration to db.
27 28 29 30 |
# File 'lib/sorcery/controller/submodules/remember_me.rb', line 27 def remember_me! current_user.remember_me! (current_user) end |