Sha256: ff46a48b1fb6c76d72ab4cad5a95e31a97109ab4d6edf41a80bcffee30c32816
Contents?: true
Size: 1.25 KB
Versions: 9
Compression:
Stored size: 1.25 KB
Contents
module GoogleAuthenticatorRails module ActionController class RailsAdapter class LoadedTooLateError < StandardError def initialize super("GoogleAuthenticatorRails is trying to prepend a before_filter in ActionController::Base. Because you've already defined" + " ApplicationController, your controllers will not get this before_filter. Please load GoogleAuthenticatorRails before defining" + " ApplicationController.") end end def initialize(controller) @controller = controller end def cookies @controller.send(:cookies) end end module Integration def self.included(klass) raise RailsAdapter::LoadedTooLateError.new if defined?(::ApplicationController) method = klass.respond_to?(:prepend_before_action) ? :prepend_before_action : :prepend_before_filter klass.send(method, :activate_google_authenticator_rails) end private def activate_google_authenticator_rails GoogleAuthenticatorRails::Session::Base.controller = RailsAdapter.new(self) end end end end if defined?(ActionController::Base) ActionController::Base.send(:include, GoogleAuthenticatorRails::ActionController::Integration) end
Version data entries
9 entries across 9 versions & 1 rubygems