invisible_captcha 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/Appraisals +1 -0
- data/CHANGELOG.md +7 -0
- data/gemfiles/rails_7.1.gemfile +7 -0
- data/lib/invisible_captcha/controller_ext.rb +4 -3
- data/lib/invisible_captcha/version.rb +1 -1
- data/spec/controllers_spec.rb +6 -6
- data/spec/dummy/app/views/layouts/application.html.erb +7 -1
- data/spec/dummy/public/styles.css +9 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b054e8cc12c7c543111eabaa13c46e4ec94d99200bf8fb189d6d1284568f9b3a
|
4
|
+
data.tar.gz: 11c94f7e36b4c2892c9def7ab86b5fcb560005fdc0c68b5beef3971eb065950c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eea98bc58a674b4daa961a5fc3bb5edafbfef74034ed06364684993d96802a7bd8c169507f208b635ba24b09fc0e0b69039f964babd874e1104ae9a29c1dc2ee
|
7
|
+
data.tar.gz: 710d6bf3c780d91525dca60566db5f20f564f784e27223af0ab9342fb95d1bc507e4bdafe687cdacd60b7496f547a5f81653b6a7ebfcca0425fd2de53a13adba
|
data/.github/workflows/ci.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## [2.2.0]
|
6
|
+
|
7
|
+
- Official support for Rails 7.1
|
8
|
+
- Fix flash message for `on_timestamp_spam` callback (#125)
|
9
|
+
- Fix potential error when lookup the honeypot parameter using (#128)
|
10
|
+
|
5
11
|
## [2.1.0]
|
6
12
|
|
7
13
|
- Drop official support for EOL Rubies: 2.5 and 2.6
|
@@ -130,6 +136,7 @@ All notable changes to this project will be documented in this file.
|
|
130
136
|
|
131
137
|
- First version of controller filters
|
132
138
|
|
139
|
+
[2.2.0]: https://github.com/markets/invisible_captcha/compare/v2.1.0...v2.2.0
|
133
140
|
[2.1.0]: https://github.com/markets/invisible_captcha/compare/v2.0.0...v2.1.0
|
134
141
|
[2.0.0]: https://github.com/markets/invisible_captcha/compare/v1.1.0...v2.0.0
|
135
142
|
[1.1.0]: https://github.com/markets/invisible_captcha/compare/v1.0.1...v1.1.0
|
@@ -30,7 +30,8 @@ module InvisibleCaptcha
|
|
30
30
|
if action = options[:on_timestamp_spam]
|
31
31
|
send(action)
|
32
32
|
else
|
33
|
-
|
33
|
+
flash[:error] = InvisibleCaptcha.timestamp_error_message
|
34
|
+
redirect_back(fallback_location: root_path)
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
@@ -88,7 +89,7 @@ module InvisibleCaptcha
|
|
88
89
|
# If honeypot is defined for this controller-action, search for:
|
89
90
|
# - honeypot: params[:subtitle]
|
90
91
|
# - honeypot with scope: params[:topic][:subtitle]
|
91
|
-
if params[honeypot].present? || params
|
92
|
+
if params[honeypot].present? || (params[scope] && params[scope][honeypot].present?)
|
92
93
|
warn_spam("Honeypot param '#{honeypot}' was present.")
|
93
94
|
return true
|
94
95
|
else
|
@@ -98,7 +99,7 @@ module InvisibleCaptcha
|
|
98
99
|
end
|
99
100
|
else
|
100
101
|
InvisibleCaptcha.honeypots.each do |default_honeypot|
|
101
|
-
if params[default_honeypot].present? || params
|
102
|
+
if params[default_honeypot].present? || (params[scope] && params[scope][default_honeypot].present?)
|
102
103
|
warn_spam("Honeypot param '#{scope}.#{default_honeypot}' was present.")
|
103
104
|
return true
|
104
105
|
end
|
data/spec/controllers_spec.rb
CHANGED
@@ -84,7 +84,7 @@ RSpec.describe InvisibleCaptcha::ControllerExt, type: :controller do
|
|
84
84
|
}
|
85
85
|
|
86
86
|
expect(flash[:error]).not_to be_present
|
87
|
-
expect(response.body).to
|
87
|
+
expect(response.body).to redirect_to(new_topic_path)
|
88
88
|
|
89
89
|
# Make sure session is cleared
|
90
90
|
expect(session[:invisible_captcha_timestamp]).to be_nil
|
@@ -96,7 +96,7 @@ RSpec.describe InvisibleCaptcha::ControllerExt, type: :controller do
|
|
96
96
|
post :publish, params: { id: 1 }
|
97
97
|
|
98
98
|
expect(flash[:error]).not_to be_present
|
99
|
-
expect(response.body).to
|
99
|
+
expect(response.body).to redirect_to(new_topic_path)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
@@ -126,13 +126,13 @@ RSpec.describe InvisibleCaptcha::ControllerExt, type: :controller do
|
|
126
126
|
it 'passes with no spam' do
|
127
127
|
post :categorize, params: { topic: { title: 'foo' } }
|
128
128
|
|
129
|
-
expect(response.body).to
|
129
|
+
expect(response.body).to redirect_to(new_topic_path)
|
130
130
|
end
|
131
131
|
|
132
132
|
it 'fails with spam' do
|
133
133
|
post :categorize, params: { topic: { "#{InvisibleCaptcha.honeypots.sample}": 'foo' } }
|
134
134
|
|
135
|
-
expect(response.body).
|
135
|
+
expect(response.body).not_to redirect_to(new_topic_path)
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -140,13 +140,13 @@ RSpec.describe InvisibleCaptcha::ControllerExt, type: :controller do
|
|
140
140
|
it 'passes with no spam' do
|
141
141
|
post :categorize
|
142
142
|
|
143
|
-
expect(response.body).to
|
143
|
+
expect(response.body).to redirect_to(new_topic_path)
|
144
144
|
end
|
145
145
|
|
146
146
|
it 'fails with spam' do
|
147
147
|
post :categorize, params: { "#{InvisibleCaptcha.honeypots.sample}": 'foo' }
|
148
148
|
|
149
|
-
expect(response.body).
|
149
|
+
expect(response.body).not_to redirect_to(new_topic_path)
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
3
|
<head>
|
4
|
-
<title>
|
4
|
+
<title>InvisibleCaptcha Demo</title>
|
5
5
|
<%= stylesheet_link_tag "/styles.css" %>
|
6
6
|
<%= csrf_meta_tags %>
|
7
7
|
<%= invisible_captcha_styles %>
|
@@ -24,5 +24,11 @@
|
|
24
24
|
<% end %>
|
25
25
|
|
26
26
|
<%= yield %>
|
27
|
+
|
28
|
+
<footer>
|
29
|
+
Running on
|
30
|
+
<b>Ruby <%= RUBY_VERSION %></b> and
|
31
|
+
<b>Rails <%= Rails.version %></b>
|
32
|
+
</footer>
|
27
33
|
</body>
|
28
34
|
</html>
|
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: 2.
|
4
|
+
version: 2.2.0
|
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: 2024-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- gemfiles/rails_6.0.gemfile
|
116
116
|
- gemfiles/rails_6.1.gemfile
|
117
117
|
- gemfiles/rails_7.0.gemfile
|
118
|
+
- gemfiles/rails_7.1.gemfile
|
118
119
|
- invisible_captcha.gemspec
|
119
120
|
- lib/invisible_captcha.rb
|
120
121
|
- lib/invisible_captcha/controller_ext.rb
|
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
181
|
- !ruby/object:Gem::Version
|
181
182
|
version: '0'
|
182
183
|
requirements: []
|
183
|
-
rubygems_version: 3.4.
|
184
|
+
rubygems_version: 3.4.10
|
184
185
|
signing_key:
|
185
186
|
specification_version: 4
|
186
187
|
summary: Honeypot spam protection for Rails
|