honeypot-captcha 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.markdown +38 -7
- data/VERSION +1 -1
- data/lib/honeypot-captcha/form_tag_helper.rb +5 -5
- metadata +92 -44
- data/.document +0 -5
- data/.gitignore +0 -21
- data/Rakefile +0 -45
- data/honeypot-captcha.gemspec +0 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2dd95647b6ac0f214feeac282a66d4e683c87def
|
4
|
+
data.tar.gz: 75dba6af51866d8c4fb4bbd65039a2c77a9bc94e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cc2c415f608f2cb8b914bb5d7362e7d3a9d750a877b3066617fe193216e1edb868ba8fa2bda78cf7f654db824d651829fc8f2e05f7c307e399902cb385ec05ec
|
7
|
+
data.tar.gz: a99e693dac0fd01e1e82214f4c5c4df5a018d8706c2131c2de64d58b7c44646c19fcaf2224c4ed5ee16b964fc7dc2bf9e7e57e56cbe5e700fb57e02f8a070807
|
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Honeypot Captcha
|
2
2
|
|
3
|
-
|
3
|
+
**The simplest way to add honeypot captchas in your Rails forms.**
|
4
4
|
|
5
5
|
Honeypot captchas work off the premise that you can present different form
|
6
6
|
fields to a spam bot than you do to a real user. Spam bots will typically try
|
@@ -12,17 +12,23 @@ submitted with values. If they are, we assume that we encountered a spam bot.
|
|
12
12
|
* [Honeypot Captcha by Phil Haack](http://haacked.com/archive/2007/09/11/honeypot-captcha.aspx)
|
13
13
|
* [Stopping spambots with hashes and honeypots](http://nedbatchelder.com/text/stopbots.html)
|
14
14
|
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
In your Gemfile, simply add
|
18
|
+
|
19
|
+
gem 'honeypot-captcha'
|
15
20
|
|
16
21
|
## Usage
|
17
22
|
|
18
23
|
I've tried to make it pretty simple to add a honeypot captcha, but I'm open to
|
19
|
-
any suggestions you may have.
|
24
|
+
any suggestions you may have. By default, `create` and `update` actions are
|
25
|
+
protected. For other actions, see [below](#protection-for-actions-other-than-create-and-update).
|
20
26
|
|
21
27
|
### form_for
|
22
28
|
|
23
29
|
Simply specify that the form has a honeypot in the HTML options hash:
|
24
30
|
|
25
|
-
|
31
|
+
<%= form_for Comment.new, :html => { :honeypot => true } do |form| -%>
|
26
32
|
...
|
27
33
|
<% end -%>
|
28
34
|
|
@@ -30,7 +36,7 @@ Simply specify that the form has a honeypot in the HTML options hash:
|
|
30
36
|
|
31
37
|
Simply specify that the form has a honeypot in the options hash:
|
32
38
|
|
33
|
-
|
39
|
+
<%= form_tag comments_path, :honeypot => true do -%>
|
34
40
|
...
|
35
41
|
<% end -%>
|
36
42
|
|
@@ -42,8 +48,31 @@ Simply specify that the form has a honeypot in the options hash:
|
|
42
48
|
...
|
43
49
|
</form>
|
44
50
|
|
51
|
+
### Protection for actions other than `create` and `update`
|
52
|
+
|
53
|
+
If you are submitting a form to a non-RESTful action and require
|
54
|
+
honeypot protection, simply add the before filter for that action
|
55
|
+
in your controller. For example:
|
56
|
+
|
57
|
+
class NewsletterController < ApplicationController
|
58
|
+
prepend_before_filter :protect_from_spam, :only => [:subscribe]
|
59
|
+
...
|
60
|
+
end
|
61
|
+
|
62
|
+
### Customizing the honeypot fields
|
63
|
+
|
64
|
+
Override the `honeypot_fields` method within `ApplicationController` to
|
65
|
+
add your own custom field names and values. For example:
|
66
|
+
|
67
|
+
def honeypot_fields
|
68
|
+
{
|
69
|
+
:my_custom_comment_body => 'Do not fill in this field, sucka!',
|
70
|
+
:another_thingy => 'Really... do not fill out!'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
45
74
|
## Note on Patches/Pull Requests
|
46
|
-
|
75
|
+
|
47
76
|
* Fork the project.
|
48
77
|
* Make your feature addition or bug fix.
|
49
78
|
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
@@ -51,12 +80,14 @@ Simply specify that the form has a honeypot in the options hash:
|
|
51
80
|
* Send me a pull request. Bonus points for topic branches.
|
52
81
|
|
53
82
|
## Author
|
54
|
-
|
55
|
-
|
83
|
+
Created by [Curtis Miller](http://millarian.com) of Velocity Labs, a
|
84
|
+
[Ruby on Rails development company](http://velocitylabs.io).
|
56
85
|
|
57
86
|
### Contributors
|
58
87
|
|
59
88
|
* [Eric Saxby](http://github.com/sax)
|
89
|
+
* [Bernard Grymonpon](https://github.com/wonko)
|
90
|
+
* [Dave Tapley](https://github.com/dukedave)
|
60
91
|
|
61
92
|
## Copyright
|
62
93
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -2,9 +2,9 @@
|
|
2
2
|
module ActionView
|
3
3
|
module Helpers
|
4
4
|
module FormTagHelper
|
5
|
-
def
|
6
|
-
honeypot = options.delete(:honeypot)
|
7
|
-
html =
|
5
|
+
def form_tag_html_with_honeypot(options)
|
6
|
+
honeypot = options.delete(:honeypot) || options.delete('honeypot')
|
7
|
+
html = form_tag_html_without_honeypot(options)
|
8
8
|
if honeypot
|
9
9
|
captcha = "".respond_to?(:html_safe) ? honey_pot_captcha.html_safe : honey_pot_captcha
|
10
10
|
if block_given?
|
@@ -15,7 +15,7 @@ module ActionView
|
|
15
15
|
end
|
16
16
|
html
|
17
17
|
end
|
18
|
-
alias_method_chain :
|
18
|
+
alias_method_chain :form_tag_html, :honeypot
|
19
19
|
|
20
20
|
private
|
21
21
|
|
@@ -34,4 +34,4 @@ module ActionView
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
-
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,71 +1,119 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeypot-captcha
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
version: 0.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- curtis
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.8.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jeweler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
21
83
|
description: A simple way to add honeypot captchas to Rails forms
|
22
|
-
email: curtis@
|
84
|
+
email: curtis@velocitylabs.io
|
23
85
|
executables: []
|
24
|
-
|
25
86
|
extensions: []
|
26
|
-
|
27
|
-
extra_rdoc_files:
|
87
|
+
extra_rdoc_files:
|
28
88
|
- LICENSE
|
29
89
|
- README.markdown
|
30
|
-
files:
|
31
|
-
- .document
|
32
|
-
- .gitignore
|
90
|
+
files:
|
33
91
|
- LICENSE
|
34
92
|
- README.markdown
|
35
|
-
- Rakefile
|
36
93
|
- VERSION
|
37
|
-
- honeypot-captcha.gemspec
|
38
94
|
- lib/honeypot-captcha.rb
|
39
95
|
- lib/honeypot-captcha/form_tag_helper.rb
|
40
|
-
has_rdoc: true
|
41
96
|
homepage: http://github.com/curtis/honeypot-captcha
|
42
97
|
licenses: []
|
43
|
-
|
98
|
+
metadata: {}
|
44
99
|
post_install_message:
|
45
|
-
rdoc_options:
|
46
|
-
|
47
|
-
require_paths:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
48
102
|
- lib
|
49
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
-
requirements:
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
51
105
|
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
-
requirements:
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
58
110
|
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
|
61
|
-
- 0
|
62
|
-
version: "0"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
63
113
|
requirements: []
|
64
|
-
|
65
114
|
rubyforge_project:
|
66
|
-
rubygems_version:
|
115
|
+
rubygems_version: 2.4.5
|
67
116
|
signing_key:
|
68
|
-
specification_version:
|
117
|
+
specification_version: 4
|
69
118
|
summary: A simple way to add honeypot captchas to Rails forms
|
70
119
|
test_files: []
|
71
|
-
|
data/.document
DELETED
data/.gitignore
DELETED
data/Rakefile
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "honeypot-captcha"
|
8
|
-
gem.summary = %Q{A simple way to add honeypot captchas to Rails forms}
|
9
|
-
gem.description = %Q{A simple way to add honeypot captchas to Rails forms}
|
10
|
-
gem.email = "curtis@flatterline.com"
|
11
|
-
gem.homepage = "http://github.com/curtis/honeypot-captcha"
|
12
|
-
gem.authors = ["curtis"]
|
13
|
-
# gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'spec/rake/spectask'
|
22
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
23
|
-
spec.libs << 'lib' << 'spec'
|
24
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
25
|
-
end
|
26
|
-
|
27
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
-
spec.libs << 'lib' << 'spec'
|
29
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
-
spec.rcov = true
|
31
|
-
end
|
32
|
-
|
33
|
-
task :spec => :check_dependencies
|
34
|
-
|
35
|
-
task :default => :spec
|
36
|
-
|
37
|
-
require 'rake/rdoctask'
|
38
|
-
Rake::RDocTask.new do |rdoc|
|
39
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
-
|
41
|
-
rdoc.rdoc_dir = 'rdoc'
|
42
|
-
rdoc.title = "honeypot-captcha #{version}"
|
43
|
-
rdoc.rdoc_files.include('README*')
|
44
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
-
end
|
data/honeypot-captcha.gemspec
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{honeypot-captcha}
|
8
|
-
s.version = "0.0.2"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["curtis"]
|
12
|
-
s.date = %q{2010-05-23}
|
13
|
-
s.description = %q{A simple way to add honeypot captchas to Rails forms}
|
14
|
-
s.email = %q{curtis@flatterline.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.markdown"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.markdown",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"honeypot-captcha.gemspec",
|
27
|
-
"lib/honeypot-captcha.rb",
|
28
|
-
"lib/honeypot-captcha/form_tag_helper.rb"
|
29
|
-
]
|
30
|
-
s.homepage = %q{http://github.com/curtis/honeypot-captcha}
|
31
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
32
|
-
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = %q{1.3.6}
|
34
|
-
s.summary = %q{A simple way to add honeypot captchas to Rails forms}
|
35
|
-
|
36
|
-
if s.respond_to? :specification_version then
|
37
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
38
|
-
s.specification_version = 3
|
39
|
-
|
40
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
41
|
-
else
|
42
|
-
end
|
43
|
-
else
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|