invisible_captcha 0.1.3 → 0.2.0
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.
- data/README.md +14 -4
- data/VERSION +1 -1
- data/invisible_captcha.gemspec +3 -4
- data/lib/invisible_captcha.rb +1 -0
- data/lib/invisible_captcha/form_helpers.rb +11 -0
- data/lib/invisible_captcha/validator.rb +2 -1
- data/lib/invisible_captcha/view_helpers.rb +10 -4
- metadata +4 -5
- data/.document +0 -5
- data/Gemfile.lock +0 -39
data/README.md
CHANGED
@@ -5,7 +5,13 @@ Simple protection for ActiveModel forms using honeypot strategy.
|
|
5
5
|
Add this line to you Gemfile:
|
6
6
|
|
7
7
|
```
|
8
|
-
gem 'invisible_captcha'
|
8
|
+
gem 'invisible_captcha'
|
9
|
+
```
|
10
|
+
|
11
|
+
Or install gem:
|
12
|
+
|
13
|
+
```
|
14
|
+
gem install invisible_captcha
|
9
15
|
```
|
10
16
|
|
11
17
|
## Usage
|
@@ -13,9 +19,13 @@ In your form:
|
|
13
19
|
|
14
20
|
```ruby
|
15
21
|
<%= form_for(@topic) do |f| %>
|
16
|
-
|
17
|
-
|
18
|
-
|
22
|
+
|
23
|
+
<!-- use form helper -->
|
24
|
+
<%= f.invisible_captcha :subtitle %>
|
25
|
+
|
26
|
+
<!-- or use view helper -->
|
27
|
+
<%= invisible_captcha :topic, :subtitle %>
|
28
|
+
|
19
29
|
<% end %>
|
20
30
|
```
|
21
31
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/invisible_captcha.gemspec
CHANGED
@@ -5,25 +5,24 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "invisible_captcha"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marc Anguera Insa"]
|
12
|
-
s.date = "2013-04
|
12
|
+
s.date = "2013-06-04"
|
13
13
|
s.description = "Simple protection for ActiveModel forms using honeypot strategy."
|
14
14
|
s.email = "srmarc.ai@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README.md"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
".document",
|
20
19
|
"Gemfile",
|
21
|
-
"Gemfile.lock",
|
22
20
|
"README.md",
|
23
21
|
"Rakefile",
|
24
22
|
"VERSION",
|
25
23
|
"invisible_captcha.gemspec",
|
26
24
|
"lib/invisible_captcha.rb",
|
25
|
+
"lib/invisible_captcha/form_helpers.rb",
|
27
26
|
"lib/invisible_captcha/validator.rb",
|
28
27
|
"lib/invisible_captcha/view_helpers.rb"
|
29
28
|
]
|
data/lib/invisible_captcha.rb
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
module InvisibleCaptcha
|
2
2
|
module ViewHelpers
|
3
3
|
|
4
|
-
def invisible_captcha
|
4
|
+
def invisible_captcha(model_name, method)
|
5
|
+
build_invisible_captcha(model_name.to_s, method.to_s)
|
6
|
+
end
|
7
|
+
|
8
|
+
protected
|
9
|
+
|
10
|
+
def build_invisible_captcha(model_name, method)
|
5
11
|
html_ids = []
|
6
12
|
{ :"#{model_name}" => 'If you are a human, do not fill in this field' }.collect do |field, label|
|
7
13
|
html_ids << (html_id = "#{field}_#{Time.now.to_i}")
|
8
|
-
content_tag
|
14
|
+
content_tag(:div, :id => html_id) do
|
9
15
|
content_tag(:style, :type => 'text/css', :media => 'screen', :scoped => "scoped") do
|
10
16
|
"#{html_ids.map { |i| "##{i}" }.join(', ')} { display:none; }"
|
11
17
|
end +
|
12
|
-
label_tag("#{field}_#{
|
13
|
-
text_field_tag("#{model_name}[#{
|
18
|
+
label_tag("#{field}_#{method}", label) +
|
19
|
+
text_field_tag("#{model_name}[#{method}]")
|
14
20
|
end
|
15
21
|
end.join.html_safe
|
16
22
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invisible_captcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04
|
12
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -82,14 +82,13 @@ extensions: []
|
|
82
82
|
extra_rdoc_files:
|
83
83
|
- README.md
|
84
84
|
files:
|
85
|
-
- .document
|
86
85
|
- Gemfile
|
87
|
-
- Gemfile.lock
|
88
86
|
- README.md
|
89
87
|
- Rakefile
|
90
88
|
- VERSION
|
91
89
|
- invisible_captcha.gemspec
|
92
90
|
- lib/invisible_captcha.rb
|
91
|
+
- lib/invisible_captcha/form_helpers.rb
|
93
92
|
- lib/invisible_captcha/validator.rb
|
94
93
|
- lib/invisible_captcha/view_helpers.rb
|
95
94
|
homepage: http://github.com/markets/invisible_captcha
|
@@ -107,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
106
|
version: '0'
|
108
107
|
segments:
|
109
108
|
- 0
|
110
|
-
hash:
|
109
|
+
hash: 922774803
|
111
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
111
|
none: false
|
113
112
|
requirements:
|
data/.document
DELETED
data/Gemfile.lock
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
activemodel (3.2.9)
|
5
|
-
activesupport (= 3.2.9)
|
6
|
-
builder (~> 3.0.0)
|
7
|
-
activesupport (3.2.9)
|
8
|
-
i18n (~> 0.6)
|
9
|
-
multi_json (~> 1.0)
|
10
|
-
builder (3.0.4)
|
11
|
-
columnize (0.3.6)
|
12
|
-
debugger (1.2.1)
|
13
|
-
columnize (>= 0.3.1)
|
14
|
-
debugger-linecache (~> 1.1.1)
|
15
|
-
debugger-ruby_core_source (~> 1.1.4)
|
16
|
-
debugger-linecache (1.1.2)
|
17
|
-
debugger-ruby_core_source (>= 1.1.1)
|
18
|
-
debugger-ruby_core_source (1.1.4)
|
19
|
-
git (1.2.5)
|
20
|
-
i18n (0.6.1)
|
21
|
-
jeweler (1.8.4)
|
22
|
-
bundler (~> 1.0)
|
23
|
-
git (>= 1.2.5)
|
24
|
-
rake
|
25
|
-
rdoc
|
26
|
-
json (1.7.5)
|
27
|
-
multi_json (1.3.7)
|
28
|
-
rake (10.0.2)
|
29
|
-
rdoc (3.12)
|
30
|
-
json (~> 1.4)
|
31
|
-
|
32
|
-
PLATFORMS
|
33
|
-
ruby
|
34
|
-
|
35
|
-
DEPENDENCIES
|
36
|
-
activemodel
|
37
|
-
bundler
|
38
|
-
debugger
|
39
|
-
jeweler
|