]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Tried to DRY the user_blocks controller. Moved the configuration of the blocking...
[rails.git] / app / controllers / application_controller.rb
index 6dbe9165ca2593b20f5fff3c7e6c46f7469016e6..012ba2446787d5d313c983f59371ba5850789386 100644 (file)
@@ -78,6 +78,12 @@ class ApplicationController < ActionController::Base
         @user = User.authenticate(:username => username, :password => passwd) # basic auth
       end
     end
+
+    # check if the user has been banned
+    unless @user.nil? or @user.blocks.empty?
+      # NOTE: need slightly more helpful message than this.
+      render :text => "You got banned!", :status => :forbidden
+    end
   end
 
   def authorize(realm='Web Password', errormessage="Couldn't authenticate you") 
@@ -174,6 +180,8 @@ class ApplicationController < ActionController::Base
     rescue OSM::APIError => ex
       report_error ex.message, ex.status
     rescue Exception => ex
+      logger.info("API threw unexpected #{ex.class} exception: #{ex.message}")
+      ex.backtrace.each { |l| logger.info(l) }
       report_error "#{ex.class}: #{ex.message}", :internal_server_error
     end
   end