Module: BravoLock::Controller::Sessions
- Defined in:
- lib/bravo_lock/controller/sessions.rb
Instance Method Summary collapse
-
#after_sign_in_path ⇒ Object
nodoc.
-
#sign_in(user) ⇒ Object
signs in the user if verified, returns the path they should be redirected to.
-
#sign_in!(user) ⇒ Object
sign in the user, no verification checks of any kind.
-
#sign_out ⇒ Object
nodoc.
Instance Method Details
#after_sign_in_path ⇒ Object
nodoc
7 8 9 10 |
# File 'lib/bravo_lock/controller/sessions.rb', line 7 def after_sign_in_path return params[:redirect] unless params[:redirect].blank? session.delete(:redirect) || main_app.home_path end |
#sign_in(user) ⇒ Object
signs in the user if verified, returns the path they should be redirected to
20 21 22 23 24 25 26 27 28 |
# File 'lib/bravo_lock/controller/sessions.rb', line 20 def sign_in(user) if user.email_verified? sign_in! user return after_sign_in_path else attrs = {:user_verification => {:email => user.email}} return new_verification_path(attrs) end end |
#sign_in!(user) ⇒ Object
sign in the user, no verification checks of any kind
14 15 16 |
# File 'lib/bravo_lock/controller/sessions.rb', line 14 def sign_in!(user) session[:user] = user.session_token end |
#sign_out ⇒ Object
nodoc
32 33 34 |
# File 'lib/bravo_lock/controller/sessions.rb', line 32 def sign_out session[:user] = nil end |