rucaptcha 0.5.0 → 0.5.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +16 -2
- data/lib/rucaptcha/captcha.rb +8 -4
- data/lib/rucaptcha/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fe1a21f8a2142b7b430c62264738016bf803c48
|
4
|
+
data.tar.gz: de11fac7290c95d9e5b6a137bd88f9a9225ac8bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2177bdc67c19738d3a953c73cc0891680500ed7492b7fa59d4f0f873d7d82f2df47175afd90310c9245b8230376fc6143985c6e488bfbee8388d4d48168a9ff6
|
7
|
+
data.tar.gz: 0d69113ab3343156f6a74a860239f3cc9da6434aa3e3289b3f40804ab3cccb0f156c3c8bdaade59a10ad1cfe0be365d8fc30d8e332314f040e00e00ec0c7c5c0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -29,7 +29,7 @@ Idea by: https://ruby-china.org/topics/20558#reply4
|
|
29
29
|
|
30
30
|
## Requirements
|
31
31
|
|
32
|
-
- ImageMagick
|
32
|
+
- ImageMagick 6.9+
|
33
33
|
|
34
34
|
#### Ubuntu
|
35
35
|
|
@@ -107,8 +107,12 @@ View `app/views/account/new.html.erb`
|
|
107
107
|
</form>
|
108
108
|
```
|
109
109
|
|
110
|
+
And if you are use Devise, you can read this to add validation: [RuCaptcha with Devise](https://github.com/huacnlee/rucaptcha/wiki/Working-with-Devise).
|
111
|
+
|
110
112
|
### Write your test skip captcha validation
|
111
113
|
|
114
|
+
for RSpec
|
115
|
+
|
112
116
|
```rb
|
113
117
|
describe 'sign up and login', type: :feature do
|
114
118
|
before do
|
@@ -119,5 +123,15 @@ describe 'sign up and login', type: :feature do
|
|
119
123
|
end
|
120
124
|
```
|
121
125
|
|
126
|
+
for MiniTest
|
122
127
|
|
123
|
-
|
128
|
+
```rb
|
129
|
+
class ActionDispatch::IntegrationTest
|
130
|
+
def sign_in(user)
|
131
|
+
ActionController::Base.any_instance.stubs(:verify_rucaptcha?).returns(true)
|
132
|
+
post user_session_path \
|
133
|
+
'user[email]' => user.email,
|
134
|
+
'user[password]' => user.password
|
135
|
+
end
|
136
|
+
end
|
137
|
+
```
|
data/lib/rucaptcha/captcha.rb
CHANGED
@@ -71,17 +71,21 @@ module RuCaptcha
|
|
71
71
|
if Gem.win_platform?
|
72
72
|
png_file_path = Rails.root.join('tmp', 'cache', "#{code}.png")
|
73
73
|
command = "convert -size #{size} xc:White -gravity Center -weight 12 -pointsize 20 -annotate 0 \"#{code}\" -trim #{png_file_path}"
|
74
|
-
|
75
|
-
|
76
|
-
raise "RuCaptcha: #{stderr_str.strip}" if stderr_str.present?
|
74
|
+
out, err, _st = Open3.capture3(command)
|
75
|
+
warn " RuCaptcha #{err.strip}" if err.present?
|
77
76
|
png_file_path
|
78
77
|
else
|
79
78
|
command.strip!
|
80
79
|
out, err, _st = Open3.capture3(command)
|
81
|
-
|
80
|
+
warn " RuCaptcha #{err.strip}" if err.present?
|
82
81
|
out
|
83
82
|
end
|
84
83
|
end
|
84
|
+
|
85
|
+
def warn(msg)
|
86
|
+
msg = " RuCaptcha #{msg}"
|
87
|
+
Rails.logger.error(msg)
|
88
|
+
end
|
85
89
|
end
|
86
90
|
end
|
87
91
|
end
|
data/lib/rucaptcha/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rucaptcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
12
|
-
dependencies:
|
11
|
+
date: 2016-06-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
13
27
|
description:
|
14
28
|
email: huacnlee@gmail.com
|
15
29
|
executables: []
|