Sha256: fc534f77770cee1d6a4c678f1eb42f9cb0962bf3eeb1fd053edbffa56f1f1ea3
Contents?: true
Size: 1.15 KB
Versions: 5
Compression:
Stored size: 1.15 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 if defined?(ActionController::Base) ActionController::Base.send(:include, GoogleAuthenticatorRails::ActionController::Integration) end
Version data entries
5 entries across 5 versions & 1 rubygems