Sha256: 558fe54eba7f2e3d2a547cb181ed958940231945711885e8490502be66333f6f
Contents?: true
Size: 1.11 KB
Versions: 7
Compression:
Stored size: 1.11 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) klass.prepend_before_filter(:activate_google_authenticator_rails) end private def activate_google_authenticator_rails GoogleAuthenticatorRails::Session::Base.controller = RailsAdapter.new(self) end end end end ActionController::Base.send(:include, GoogleAuthenticatorRails::ActionController::Integration)
Version data entries
7 entries across 7 versions & 1 rubygems