invisible_captcha 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +18 -3
- data/Appraisals +5 -1
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/gemfiles/rails_4.2.gemfile +1 -1
- data/gemfiles/rails_5.0.gemfile +7 -0
- data/invisible_captcha.gemspec +2 -3
- data/lib/invisible_captcha/controller_ext.rb +8 -2
- data/lib/invisible_captcha/version.rb +1 -1
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/development.rb +3 -3
- data/spec/dummy/config/environments/production.rb +26 -19
- data/spec/dummy/config/environments/test.rb +10 -10
- data/spec/spec_helper.rb +0 -4
- metadata +6 -8
- data/.rspec +0 -2
- data/spec/dummy/config/initializers/assets.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd5997c0dafd14fd6ddf1dea96a9cbc3c33ae172
|
4
|
+
data.tar.gz: b615f78ab1c2ffa6a62e9633b6d2edee8c6b3de5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bd891628a17962b2e098bd5e10b60757ecd4fe6ec6012d8dbb484ed6914acd46a4e9981299ad9b117d448433eb07abf86bd3046c67dd76ce8318de92ea1afe3
|
7
|
+
data.tar.gz: 4e7730bd1d87dcf0e5f095af3bff41deb830c5a37a17385b4048445e78f6249ae700487b8077b01685f90f6b3e89a9d5c9ce438a60cc108446594897e23263b8
|
data/.travis.yml
CHANGED
@@ -5,12 +5,27 @@ cache: bundler
|
|
5
5
|
sudo: false
|
6
6
|
|
7
7
|
rvm:
|
8
|
-
- 2.
|
9
|
-
- 2.
|
8
|
+
- 2.4.0
|
9
|
+
- 2.3.3
|
10
|
+
- 2.2.6
|
10
11
|
- 2.1
|
11
12
|
- 1.9.3
|
12
13
|
|
13
14
|
gemfile:
|
15
|
+
- gemfiles/rails_5.0.gemfile
|
14
16
|
- gemfiles/rails_4.2.gemfile
|
15
17
|
- gemfiles/rails_4.1.gemfile
|
16
|
-
- gemfiles/rails_3.2.gemfile
|
18
|
+
- gemfiles/rails_3.2.gemfile
|
19
|
+
|
20
|
+
matrix:
|
21
|
+
exclude:
|
22
|
+
- rvm: 1.9.3
|
23
|
+
gemfile: gemfiles/rails_4.2.gemfile
|
24
|
+
- rvm: 1.9.3
|
25
|
+
gemfile: gemfiles/rails_5.0.gemfile
|
26
|
+
- rvm: 2.1
|
27
|
+
gemfile: gemfiles/rails_5.0.gemfile
|
28
|
+
- rvm: 2.4.0
|
29
|
+
gemfile: gemfiles/rails_4.1.gemfile
|
30
|
+
- rvm: 2.4.0
|
31
|
+
gemfile: gemfiles/rails_3.2.gemfile
|
data/Appraisals
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -50,7 +50,7 @@ class TopicsController < ApplicationController
|
|
50
50
|
end
|
51
51
|
```
|
52
52
|
|
53
|
-
This method will act as a `
|
53
|
+
This method will act as a `before_action` that triggers when spam is detected (honeypot field has some value). By default it responds with no content (only headers: `head(200)`). This is a good default, since the bot will surely read the response code and will think that it has achieved to submit the form properly. But, anyway, you are able to define your own callback by passing a method to the `on_spam` option:
|
54
54
|
|
55
55
|
```ruby
|
56
56
|
class TopicsController < ApplicationController
|
@@ -174,4 +174,4 @@ $ bundle exec rake web # PORT=4000 (default: 3000)
|
|
174
174
|
|
175
175
|
## License
|
176
176
|
|
177
|
-
Copyright (c)
|
177
|
+
Copyright (c) Marc Anguera. Invisible Captcha is released under the [MIT](LICENSE) License.
|
data/gemfiles/rails_4.2.gemfile
CHANGED
data/invisible_captcha.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
require 'invisible_captcha/version'
|
1
|
+
require './lib/invisible_captcha/version'
|
3
2
|
|
4
3
|
Gem::Specification.new do |spec|
|
5
4
|
spec.name = "invisible_captcha"
|
@@ -16,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
16
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
17
16
|
spec.require_paths = ["lib"]
|
18
17
|
|
19
|
-
spec.add_dependency 'rails'
|
18
|
+
spec.add_dependency 'rails', '>= 3.2.0'
|
20
19
|
|
21
20
|
spec.add_development_dependency 'rspec-rails', '~> 3.1'
|
22
21
|
spec.add_development_dependency 'appraisal'
|
@@ -2,8 +2,14 @@ module InvisibleCaptcha
|
|
2
2
|
module ControllerExt
|
3
3
|
module ClassMethods
|
4
4
|
def invisible_captcha(options = {})
|
5
|
-
|
6
|
-
|
5
|
+
if respond_to? :before_action
|
6
|
+
before_action(options) do
|
7
|
+
detect_spam(options)
|
8
|
+
end
|
9
|
+
else
|
10
|
+
before_filter(options) do
|
11
|
+
detect_spam(options)
|
12
|
+
end
|
7
13
|
end
|
8
14
|
end
|
9
15
|
end
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -25,16 +25,16 @@ Dummy::Application.configure do
|
|
25
25
|
# Debug mode disables concatenation and preprocessing of assets.
|
26
26
|
# This option may cause significant delays in view rendering with a large
|
27
27
|
# number of complex assets.
|
28
|
-
config.assets.debug = true
|
28
|
+
# config.assets.debug = true
|
29
29
|
|
30
30
|
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
31
|
# yet still be able to expire them through the digest params.
|
32
|
-
config.assets.digest = true
|
32
|
+
# config.assets.digest = true
|
33
33
|
|
34
34
|
# Adds additional error checking when serving assets at runtime.
|
35
35
|
# Checks for improperly declared sprockets dependencies.
|
36
36
|
# Raises helpful error messages.
|
37
|
-
config.assets.raise_runtime_errors = true
|
37
|
+
# config.assets.raise_runtime_errors = true
|
38
38
|
|
39
39
|
# Raises error for missing translations
|
40
40
|
# config.action_view.raise_on_missing_translations = true
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Rails.application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# Code is not reloaded between requests.
|
@@ -14,15 +14,9 @@ Dummy::Application.configure do
|
|
14
14
|
config.consider_all_requests_local = false
|
15
15
|
config.action_controller.perform_caching = true
|
16
16
|
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
-
# NGINX, varnish or squid.
|
21
|
-
# config.action_dispatch.rack_cache = true
|
22
|
-
|
23
17
|
# Disable serving static files from the `/public` folder by default since
|
24
18
|
# Apache or NGINX already handles this.
|
25
|
-
config.
|
19
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
20
|
|
27
21
|
# Compress JavaScripts and CSS.
|
28
22
|
config.assets.js_compressor = :uglifier
|
@@ -31,16 +25,20 @@ Dummy::Application.configure do
|
|
31
25
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
26
|
config.assets.compile = false
|
33
27
|
|
34
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
35
|
-
# yet still be able to expire them through the digest params.
|
36
|
-
config.assets.digest = true
|
37
|
-
|
38
28
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
39
29
|
|
30
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
31
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
32
|
+
|
40
33
|
# Specifies the header that your server uses for sending files.
|
41
34
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
35
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
43
36
|
|
37
|
+
# Mount Action Cable outside main process or domain
|
38
|
+
# config.action_cable.mount_path = nil
|
39
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
40
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
41
|
+
|
44
42
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
43
|
# config.force_ssl = true
|
46
44
|
|
@@ -49,16 +47,15 @@ Dummy::Application.configure do
|
|
49
47
|
config.log_level = :debug
|
50
48
|
|
51
49
|
# Prepend all log lines with the following tags.
|
52
|
-
|
53
|
-
|
54
|
-
# Use a different logger for distributed setups.
|
55
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
50
|
+
config.log_tags = [ :request_id ]
|
56
51
|
|
57
52
|
# Use a different cache store in production.
|
58
53
|
# config.cache_store = :mem_cache_store
|
59
54
|
|
60
|
-
#
|
61
|
-
# config.
|
55
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
56
|
+
# config.active_job.queue_adapter = :resque
|
57
|
+
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
58
|
+
config.action_mailer.perform_caching = false
|
62
59
|
|
63
60
|
# Ignore bad email addresses and do not raise email delivery errors.
|
64
61
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
@@ -74,6 +71,16 @@ Dummy::Application.configure do
|
|
74
71
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
75
72
|
config.log_formatter = ::Logger::Formatter.new
|
76
73
|
|
74
|
+
# Use a different logger for distributed setups.
|
75
|
+
# require 'syslog/logger'
|
76
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
77
|
+
|
78
|
+
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
79
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
80
|
+
logger.formatter = config.log_formatter
|
81
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
82
|
+
end
|
83
|
+
|
77
84
|
# Do not dump schema after migrations.
|
78
|
-
|
85
|
+
config.active_record.dump_schema_after_migration = false
|
79
86
|
end
|
@@ -12,9 +12,15 @@ Dummy::Application.configure do
|
|
12
12
|
# preloads Rails for running tests, you may have to set it to true.
|
13
13
|
config.eager_load = false
|
14
14
|
|
15
|
-
#
|
16
|
-
|
17
|
-
|
15
|
+
# Disable serving static files from the `/public` folder by default since
|
16
|
+
# Apache or NGINX already handles this.
|
17
|
+
if Rails.version >= "5.0.0"
|
18
|
+
config.public_file_server.enabled = true
|
19
|
+
config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
|
20
|
+
else
|
21
|
+
config.serve_static_files = true
|
22
|
+
config.static_cache_control = "public, max-age=3600"
|
23
|
+
end
|
18
24
|
|
19
25
|
# Show full error reports and disable caching.
|
20
26
|
config.consider_all_requests_local = true
|
@@ -31,12 +37,6 @@ Dummy::Application.configure do
|
|
31
37
|
# ActionMailer::Base.deliveries array.
|
32
38
|
config.action_mailer.delivery_method = :test
|
33
39
|
|
34
|
-
# Randomize the order test cases are executed.
|
35
|
-
config.active_support.test_order = :random
|
36
|
-
|
37
40
|
# Print deprecation notices to the stderr.
|
38
41
|
config.active_support.deprecation = :stderr
|
39
|
-
|
40
|
-
# Raises error for missing translations
|
41
|
-
# config.action_view.raise_on_missing_translations = true
|
42
|
-
end
|
42
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.2
|
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: 2017-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,7 +89,6 @@ extensions: []
|
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
91
|
- ".gitignore"
|
92
|
-
- ".rspec"
|
93
92
|
- ".travis.yml"
|
94
93
|
- Appraisals
|
95
94
|
- Gemfile
|
@@ -99,6 +98,7 @@ files:
|
|
99
98
|
- gemfiles/rails_3.2.gemfile
|
100
99
|
- gemfiles/rails_4.1.gemfile
|
101
100
|
- gemfiles/rails_4.2.gemfile
|
101
|
+
- gemfiles/rails_5.0.gemfile
|
102
102
|
- invisible_captcha.gemspec
|
103
103
|
- lib/invisible_captcha.rb
|
104
104
|
- lib/invisible_captcha/controller_ext.rb
|
@@ -130,7 +130,6 @@ files:
|
|
130
130
|
- spec/dummy/config/environments/development.rb
|
131
131
|
- spec/dummy/config/environments/production.rb
|
132
132
|
- spec/dummy/config/environments/test.rb
|
133
|
-
- spec/dummy/config/initializers/assets.rb
|
134
133
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
135
134
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
136
135
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
@@ -172,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
171
|
version: '0'
|
173
172
|
requirements: []
|
174
173
|
rubyforge_project:
|
175
|
-
rubygems_version: 2.
|
174
|
+
rubygems_version: 2.5.2
|
176
175
|
signing_key:
|
177
176
|
specification_version: 4
|
178
177
|
summary: Simple honeypot protection for RoR apps
|
@@ -201,7 +200,6 @@ test_files:
|
|
201
200
|
- spec/dummy/config/environments/development.rb
|
202
201
|
- spec/dummy/config/environments/production.rb
|
203
202
|
- spec/dummy/config/environments/test.rb
|
204
|
-
- spec/dummy/config/initializers/assets.rb
|
205
203
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
206
204
|
- spec/dummy/config/initializers/cookies_serializer.rb
|
207
205
|
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
data/.rspec
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Version of your assets, change this if you want to expire all your assets.
|
4
|
-
Rails.application.config.assets.version = '1.0'
|
5
|
-
|
6
|
-
# Add additional assets to the asset load path
|
7
|
-
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
-
|
9
|
-
# Precompile additional assets.
|
10
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
-
# Rails.application.config.assets.precompile += %w( search.js )
|