]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
First version of blocking feature. Allows both time-based (for map protection) and...
[rails.git] / app / controllers / application_controller.rb
index c43271b93a81faf5b3426a75097ac5fc1053f0e5..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")