webapp/app/controllers/application_controller.rb in cloud-toaster-1.1.5 vs webapp/app/controllers/application_controller.rb in cloud-toaster-1.1.6
- old
+ new
@@ -3,12 +3,20 @@
class ApplicationController < BaseController
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery :with => :exception
- # use authentication based on "devise"
- before_filter :authenticate_user!
-
# global requires
$LOAD_PATH << File.join(File.dirname(__FILE__), "../../../../../lib")
+
+ # use authentication based on "devise"
+ #before_filter :authenticate_user!
+ include Devise::Controllers::Helpers
+ before_filter do
+ fail "bad ancestor" unless self.kind_of?(Devise::Controllers::Helpers)
+ fail "no mapping" unless Devise.class_variable_get(:@@mappings)[:user]
+ authenticate_user!
+ end
+
+ #acts_as_token_authentication_handler_for User, :fallback_to_devise => false
end