Module: PagesCore::Authentication
- Extended by:
- ActiveSupport::Concern
- Included in:
- BaseController
- Defined in:
- app/controllers/concerns/pages_core/authentication.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the current user if logged in, or nil.
Instance Method Summary collapse
- #authenticate!(user) ⇒ Object
- #deauthenticate! ⇒ Object
-
#logged_in? ⇒ Boolean
Returns true if the user is logged in.
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the current user if logged in, or nil.
14 15 16 |
# File 'app/controllers/concerns/pages_core/authentication.rb', line 14 def current_user @current_user end |
Instance Method Details
#authenticate!(user) ⇒ Object
21 22 23 24 |
# File 'app/controllers/concerns/pages_core/authentication.rb', line 21 def authenticate!(user) reset_session authenticated(user) end |
#deauthenticate! ⇒ Object
26 27 28 29 |
# File 'app/controllers/concerns/pages_core/authentication.rb', line 26 def deauthenticate! @current_user = nil reset_session end |
#logged_in? ⇒ Boolean
Returns true if the user is logged in.
17 18 19 |
# File 'app/controllers/concerns/pages_core/authentication.rb', line 17 def logged_in? current_user ? true : false end |