aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/public_body_change_requests_controller.rb
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2014-08-28 15:43:46 +0100
committerGareth Rees <gareth@mysociety.org>2014-08-28 15:43:46 +0100
commitd801fff4325a42f1bbbb273ac0a4597c32b4dd4b (patch)
tree5b9d4828b2c6bf8415ccabb0140eb730ed12ceca /app/controllers/public_body_change_requests_controller.rb
parent0b511943ef5a8835af34842291725d1dce74b25a (diff)
parent533f0ab5f402e110f42d50fb6906a6b58ae312f7 (diff)
Merge remote-tracking branch 'origin/release/0.19'0.19
Diffstat (limited to 'app/controllers/public_body_change_requests_controller.rb')
-rw-r--r--app/controllers/public_body_change_requests_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/public_body_change_requests_controller.rb b/app/controllers/public_body_change_requests_controller.rb
index 4a6c5f5cb..773308546 100644
--- a/app/controllers/public_body_change_requests_controller.rb
+++ b/app/controllers/public_body_change_requests_controller.rb
@@ -1,5 +1,7 @@
class PublicBodyChangeRequestsController < ApplicationController
+ before_filter :catch_spam, :only => [:create]
+
def create
@change_request = PublicBodyChangeRequest.from_params(params[:public_body_change_request], @user)
if @change_request.save
@@ -23,6 +25,16 @@ class PublicBodyChangeRequestsController < ApplicationController
else
@title = _('Ask us to add an authority')
end
+ end
+
+ private
+ def catch_spam
+ if params[:public_body_change_request].key?(:comment)
+ unless params[:public_body_change_request][:comment].empty?
+ redirect_to frontpage_url
+ end
+ end
end
+
end