Class: Decidim::Devise::SessionsController
- Inherits:
-
Devise::SessionsController
- Object
- Devise::SessionsController
- Decidim::Devise::SessionsController
- Includes:
- LocaleSwitcher, NeedsOrganization
- Defined in:
- app/controllers/decidim/devise/sessions_controller.rb
Overview
Custom Devise SessionsController to avoid namespace problems.
Instance Method Summary collapse
- #after_sign_in_path_for(user) ⇒ Object
- #first_login_and_not_authorized?(user) ⇒ Boolean
-
#pending_redirect?(user) ⇒ Boolean
Calling the ‘stored_location_for` method removes the key, so in order to check if there’s any pending redirect after login I need to call this method and use the value to set a pending redirect.
Instance Method Details
#after_sign_in_path_for(user) ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/controllers/decidim/devise/sessions_controller.rb', line 13 def after_sign_in_path_for(user) if !pending_redirect?(user) && (user) else super end end |
#first_login_and_not_authorized?(user) ⇒ Boolean
29 30 31 |
# File 'app/controllers/decidim/devise/sessions_controller.rb', line 29 def (user) user.is_a?(User) && user.sign_in_count == 1 && Decidim..any? end |
#pending_redirect?(user) ⇒ Boolean
Calling the ‘stored_location_for` method removes the key, so in order to check if there’s any pending redirect after login I need to call this method and use the value to set a pending redirect. This is the only way to do this without checking the session directly.
25 26 27 |
# File 'app/controllers/decidim/devise/sessions_controller.rb', line 25 def pending_redirect?(user) store_location_for(user, stored_location_for(user)) end |