invisible_captcha 0.8.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -1
- data/.rspec +2 -0
- data/.travis.yml +13 -2
- data/Appraisals +11 -0
- data/LICENSE +1 -1
- data/README.md +62 -63
- data/gemfiles/rails_3.2.gemfile +7 -0
- data/gemfiles/rails_4.1.gemfile +7 -0
- data/gemfiles/rails_4.2.gemfile +7 -0
- data/invisible_captcha.gemspec +5 -2
- data/lib/invisible_captcha/controller_ext.rb +35 -2
- data/lib/invisible_captcha/railtie.rb +1 -3
- data/lib/invisible_captcha/version.rb +1 -1
- data/lib/invisible_captcha/view_helpers.rb +5 -2
- data/lib/invisible_captcha.rb +38 -5
- data/spec/controllers_spec.rb +84 -11
- data/spec/dummy/app/controllers/topics_controller.rb +12 -1
- data/spec/dummy/app/models/topic.rb +0 -1
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +16 -5
- data/spec/dummy/config/boot.rb +2 -4
- data/spec/dummy/config/environment.rb +3 -3
- data/spec/dummy/config/environments/development.rb +23 -12
- data/spec/dummy/config/environments/production.rb +45 -33
- data/spec/dummy/config/environments/test.rb +19 -11
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +6 -5
- data/spec/dummy/config/initializers/mime_types.rb +0 -1
- data/spec/dummy/config/initializers/session_store.rb +1 -6
- data/spec/dummy/config/initializers/wrap_parameters.rb +7 -2
- data/spec/dummy/config/locales/en.yml +20 -2
- data/spec/dummy/config/routes.rb +6 -2
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/invisible_captcha_spec.rb +36 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/view_helpers_spec.rb +22 -4
- metadata +67 -9
- data/lib/invisible_captcha/validator.rb +0 -15
- data/spec/dummy/script/rails +0 -5
- data/spec/validator_spec.rb +0 -12
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: invisible_captcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Anguera Insa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -38,8 +38,50 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.1'
|
41
|
-
|
42
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: appraisal
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: test-unit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mime-types
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "<"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "<"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.0'
|
83
|
+
description: Unobtrusive, flexible and simple spam protection for Rails applications
|
84
|
+
using honeypot strategy for better user experience.
|
43
85
|
email:
|
44
86
|
- srmarc.ai@gmail.com
|
45
87
|
executables: []
|
@@ -47,17 +89,21 @@ extensions: []
|
|
47
89
|
extra_rdoc_files: []
|
48
90
|
files:
|
49
91
|
- ".gitignore"
|
92
|
+
- ".rspec"
|
50
93
|
- ".travis.yml"
|
94
|
+
- Appraisals
|
51
95
|
- Gemfile
|
52
96
|
- LICENSE
|
53
97
|
- README.md
|
54
98
|
- Rakefile
|
99
|
+
- gemfiles/rails_3.2.gemfile
|
100
|
+
- gemfiles/rails_4.1.gemfile
|
101
|
+
- gemfiles/rails_4.2.gemfile
|
55
102
|
- invisible_captcha.gemspec
|
56
103
|
- lib/invisible_captcha.rb
|
57
104
|
- lib/invisible_captcha/controller_ext.rb
|
58
105
|
- lib/invisible_captcha/form_helpers.rb
|
59
106
|
- lib/invisible_captcha/railtie.rb
|
60
|
-
- lib/invisible_captcha/validator.rb
|
61
107
|
- lib/invisible_captcha/version.rb
|
62
108
|
- lib/invisible_captcha/view_helpers.rb
|
63
109
|
- spec/controllers_spec.rb
|
@@ -73,6 +119,10 @@ files:
|
|
73
119
|
- spec/dummy/app/models/topic.rb
|
74
120
|
- spec/dummy/app/views/layouts/application.html.erb
|
75
121
|
- spec/dummy/app/views/topics/new.html.erb
|
122
|
+
- spec/dummy/bin/bundle
|
123
|
+
- spec/dummy/bin/rails
|
124
|
+
- spec/dummy/bin/rake
|
125
|
+
- spec/dummy/bin/setup
|
76
126
|
- spec/dummy/config.ru
|
77
127
|
- spec/dummy/config/application.rb
|
78
128
|
- spec/dummy/config/boot.rb
|
@@ -80,7 +130,10 @@ files:
|
|
80
130
|
- spec/dummy/config/environments/development.rb
|
81
131
|
- spec/dummy/config/environments/production.rb
|
82
132
|
- spec/dummy/config/environments/test.rb
|
133
|
+
- spec/dummy/config/initializers/assets.rb
|
83
134
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
135
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
136
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
84
137
|
- spec/dummy/config/initializers/inflections.rb
|
85
138
|
- spec/dummy/config/initializers/invisible_captcha.rb
|
86
139
|
- spec/dummy/config/initializers/mime_types.rb
|
@@ -89,16 +142,15 @@ files:
|
|
89
142
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
90
143
|
- spec/dummy/config/locales/en.yml
|
91
144
|
- spec/dummy/config/routes.rb
|
145
|
+
- spec/dummy/config/secrets.yml
|
92
146
|
- spec/dummy/lib/assets/.gitkeep
|
93
147
|
- spec/dummy/log/.gitkeep
|
94
148
|
- spec/dummy/public/404.html
|
95
149
|
- spec/dummy/public/422.html
|
96
150
|
- spec/dummy/public/500.html
|
97
151
|
- spec/dummy/public/favicon.ico
|
98
|
-
- spec/dummy/script/rails
|
99
152
|
- spec/invisible_captcha_spec.rb
|
100
153
|
- spec/spec_helper.rb
|
101
|
-
- spec/validator_spec.rb
|
102
154
|
- spec/view_helpers_spec.rb
|
103
155
|
homepage: https://github.com/markets/invisible_captcha
|
104
156
|
licenses:
|
@@ -138,6 +190,10 @@ test_files:
|
|
138
190
|
- spec/dummy/app/models/topic.rb
|
139
191
|
- spec/dummy/app/views/layouts/application.html.erb
|
140
192
|
- spec/dummy/app/views/topics/new.html.erb
|
193
|
+
- spec/dummy/bin/bundle
|
194
|
+
- spec/dummy/bin/rails
|
195
|
+
- spec/dummy/bin/rake
|
196
|
+
- spec/dummy/bin/setup
|
141
197
|
- spec/dummy/config.ru
|
142
198
|
- spec/dummy/config/application.rb
|
143
199
|
- spec/dummy/config/boot.rb
|
@@ -145,7 +201,10 @@ test_files:
|
|
145
201
|
- spec/dummy/config/environments/development.rb
|
146
202
|
- spec/dummy/config/environments/production.rb
|
147
203
|
- spec/dummy/config/environments/test.rb
|
204
|
+
- spec/dummy/config/initializers/assets.rb
|
148
205
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
206
|
+
- spec/dummy/config/initializers/cookies_serializer.rb
|
207
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
149
208
|
- spec/dummy/config/initializers/inflections.rb
|
150
209
|
- spec/dummy/config/initializers/invisible_captcha.rb
|
151
210
|
- spec/dummy/config/initializers/mime_types.rb
|
@@ -154,14 +213,13 @@ test_files:
|
|
154
213
|
- spec/dummy/config/initializers/wrap_parameters.rb
|
155
214
|
- spec/dummy/config/locales/en.yml
|
156
215
|
- spec/dummy/config/routes.rb
|
216
|
+
- spec/dummy/config/secrets.yml
|
157
217
|
- spec/dummy/lib/assets/.gitkeep
|
158
218
|
- spec/dummy/log/.gitkeep
|
159
219
|
- spec/dummy/public/404.html
|
160
220
|
- spec/dummy/public/422.html
|
161
221
|
- spec/dummy/public/500.html
|
162
222
|
- spec/dummy/public/favicon.ico
|
163
|
-
- spec/dummy/script/rails
|
164
223
|
- spec/invisible_captcha_spec.rb
|
165
224
|
- spec/spec_helper.rb
|
166
|
-
- spec/validator_spec.rb
|
167
225
|
- spec/view_helpers_spec.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module InvisibleCaptcha
|
2
|
-
class InvisibleCaptchaValidator < ActiveModel::EachValidator
|
3
|
-
def validate_each(record, attribute, value)
|
4
|
-
if invisible_captcha?(record, attribute)
|
5
|
-
record.errors[:base] = InvisibleCaptcha.error_message
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def invisible_captcha?(object, honeypot)
|
12
|
-
object.send(honeypot).present?
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
data/spec/dummy/script/rails
DELETED
data/spec/validator_spec.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe InvisibleCaptcha::InvisibleCaptchaValidator do
|
4
|
-
it 'do not pass validations if honeypot is presented' do
|
5
|
-
topic = Topic.new(title: 'foo')
|
6
|
-
expect(topic.valid?).to be true
|
7
|
-
|
8
|
-
topic.subtitle = 'foo'
|
9
|
-
expect(topic.valid?).to be false
|
10
|
-
expect(topic.errors.messages[:base]).to eq [InvisibleCaptcha.error_message]
|
11
|
-
end
|
12
|
-
end
|