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.
-
#forget_me! ⇒ Object
Clears the cookie and clears the token from the db.
-
#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.
31 32 33 34 35 |
# File 'lib/sorcery/controller/submodules/remember_me.rb', line 31 def auto_login(user, should_remember = false) session[:user_id] = user.id @current_user = user remember_me! if should_remember end |
#forget_me! ⇒ Object
Clears the cookie and clears the token from the db.
24 25 26 27 |
# File 'lib/sorcery/controller/submodules/remember_me.rb', line 24 def forget_me! current_user.forget_me! [:remember_me_token] = nil end |
#remember_me! ⇒ Object
This method sets the cookie and calls the user to save the token and the expiration to db.
18 19 20 21 |
# File 'lib/sorcery/controller/submodules/remember_me.rb', line 18 def remember_me! current_user.remember_me! (current_user) end |