diff --git a/Gemfile.lock b/Gemfile.lock index 075f929..d3ffc97 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,7 +6,7 @@ GIT GIT remote: https://github.com/activescaffold/active_scaffold.git - revision: da126afef3d59bb0b1e8cbefb6af9186e0146275 + revision: 082cf10d1b88c3f2d208480e9841d0468cb8b47f specs: active_scaffold (3.1.5) rails (~> 3.1.0) @@ -94,7 +94,7 @@ GEM i18n (~> 0.4) ffi (1.0.9) fssm (0.2.7) - guard (0.8.6) + guard (0.8.7) thor (~> 0.14.6) guard-rspec (0.4.5) guard (>= 0.4.0) @@ -203,7 +203,7 @@ GEM polyglot polyglot (>= 0.3.1) tzinfo (0.3.30) - uglifier (1.0.3) + uglifier (1.0.4) execjs (>= 0.3.0) multi_json (>= 1.0.2) warden (1.0.6) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 21df3d9..09f9d75 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,6 +2,7 @@ class ApplicationController < ActionController::Base before_filter :authenticate_user! include SentientController protect_from_forgery + before_filter :check_honeypot rescue_from CanCan::AccessDenied, ActiveScaffold::ActionNotAllowed do |exception| flash.now[:error] = exception.message @@ -35,4 +36,8 @@ class ApplicationController < ActionController::Base helper_method :client_remote_ip helper_method :respond_to + def check_honeypot + render :nothing => true if params[Settings.honeypot].present? + end + end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c5a6972..958166c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -24,8 +24,8 @@ module ApplicationHelper messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join sentence = I18n.t("errors.messages.not_saved", - :count => resource.errors.count, - :resource => resource.class.model_name.human.downcase) + :count => resource.errors.count, + :resource => resource.class.model_name.human.downcase) html = <<-HTML