Skip to content

Commit

Permalink
Implement honeypot to prevent spam.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Dutil committed Jan 15, 2013
1 parent 8418f30 commit 7d80a34
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'http://rubygems.org'

gem 'rack-honeypot', github: 'jdutil/rack-honeypot', branch: 'fix_each_error'
gemspec
1 change: 1 addition & 0 deletions lib/spree_contact_us.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'rack/honeypot'
require 'spree_core'
require 'spree_contact_us/engine'

Expand Down
6 changes: 5 additions & 1 deletion lib/spree_contact_us/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ class Engine < Rails::Engine

config.autoload_paths += %W(#{config.root}/lib)

initializer "spree.contact_us.preferences", :after => "spree.environment" do |app|
initializer "spree_contact_us.add_middleware" do |app|
app.middleware.use Rack::Honeypot
end

initializer "spree_contact_us.preferences", :after => "spree.environment" do |app|
module Spree::ContactUs
Config = Spree::ContactUsConfiguration.new
end
Expand Down
1 change: 1 addition & 0 deletions spree_contact_us.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Gem::Specification.new do |s|
s.require_path = 'lib'
s.requirements << 'none'

s.add_dependency 'rack-honeypot'
s.add_dependency 'spree_core', '~> 1.3.1'

s.add_development_dependency 'capybara', '~> 1.1'
Expand Down

0 comments on commit 7d80a34

Please sign in to comment.