aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/public_body_change_requests_controller.rb12
-rw-r--r--app/views/public_body_change_requests/new.html.erb5
2 files changed, 17 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
diff --git a/app/views/public_body_change_requests/new.html.erb b/app/views/public_body_change_requests/new.html.erb
index 7079cd868..b52d583be 100644
--- a/app/views/public_body_change_requests/new.html.erb
+++ b/app/views/public_body_change_requests/new.html.erb
@@ -54,6 +54,11 @@
<%= f.text_area :notes, :rows => 10, :cols => 60 %>
</p>
+ <p style="display:none;">
+ <%= label_tag 'public_body_change_request[comment]', _('Do not fill in this field') %>
+ <%= text_field_tag 'public_body_change_request[comment]' %>
+ </p>
+
<div class="form_button">
<%= submit_tag _("Submit request") %>
</div>