Module: DeviseInstant2fa::Controllers::Helpers
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise_instant2fa/controllers/helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(source) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/devise_instant2fa/controllers/helpers.rb', line 6 def self.included(source) if source.respond_to?(:before_action) # Rails 4+ source.send(:before_action, :handle_two_factor_authentication, :if => :is_signing_in?) elsif source.respond_to?(:before_filter) # Rails 3 source.send(:before_filter, :handle_two_factor_authentication, :if => :is_signing_in?) end end |
Instance Method Details
#is_devise_sessions_controller? ⇒ Boolean
14 15 16 |
# File 'lib/devise_instant2fa/controllers/helpers.rb', line 14 def is_devise_sessions_controller? self.class == Devise::SessionsController || self.class.ancestors.include?(Devise::SessionsController) end |
#is_signing_in? ⇒ Boolean
18 19 20 21 22 23 24 25 26 |
# File 'lib/devise_instant2fa/controllers/helpers.rb', line 18 def is_signing_in? if devise_controller? && signed_in?(resource_name) && is_devise_sessions_controller? && self.action_name == "create" return true end return false end |