diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-08-21 11:58:51 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-08-21 11:58:51 +0100 |
commit | bd4d027c4445d40e8af120774ca3c72a9e041d6d (patch) | |
tree | 34b1396381c81083e73bdf877cff77c51a17bc79 /app/controllers/public_body_change_requests_controller.rb | |
parent | 250600040a52729637d6124c2c2e01c97e991cf3 (diff) | |
parent | 64a1f148fedcf375a47f959edbdd4cab0170acea (diff) |
Merge branch 'issues/1389-public-body-updates-spam' into rails-3-develop
Diffstat (limited to 'app/controllers/public_body_change_requests_controller.rb')
-rw-r--r-- | app/controllers/public_body_change_requests_controller.rb | 12 |
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 |