new_google_recaptcha 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -3
- data/lib/new_google_recaptcha/validator.rb +5 -2
- data/lib/new_google_recaptcha/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 690bbab5d0efb4695fd3622e53021f319b93f54a25a41d517cbca95814b3c343
|
4
|
+
data.tar.gz: 16fb89da58e6a296b4b0742eea6c706c7bc80ef20cb814123f6f23cb075f521f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cbc2e03889459b96b9bf4e15f554e848f67249c3947b715b37e014320b2126f9353d1553050c936ec6dcc3cb3352959b21be8e96d2cd665c7373c7ef0e0c8bd
|
7
|
+
data.tar.gz: 96c882a970531ac9bb8ffeee2429213e1d52bbb18f0f4529af4e1597fdc4654266d2b9b852ab7902d8f2a8deb52bfe6788f69aeeb668c64d5b6f335c8dfd5d6a
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Google Recaptcha v3 + Rails
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/igorkasyanchuk/new_google_recaptcha.svg?branch=master)](https://travis-ci.org/igorkasyanchuk/new_google_recaptcha)
|
4
|
+
|
3
5
|
Integrate Google Recaptcha v3 with Rails app.
|
4
6
|
|
5
7
|
Google Recaptcha console: https://www.google.com/recaptcha/admin#list
|
@@ -44,14 +46,13 @@ Recaptcha v3 documentation: https://developers.google.com/recaptcha/docs/v3
|
|
44
46
|
render :new
|
45
47
|
end
|
46
48
|
end
|
47
|
-
|
49
|
+
|
48
50
|
|
49
51
|
# or
|
50
52
|
# if you need to capture a humanity `score` from Google
|
51
53
|
# before you need to add a column for example `humanity_score` (type: float) where this score will be saved.
|
52
54
|
|
53
55
|
|
54
|
-
```ruby
|
55
56
|
def create
|
56
57
|
@post = Post.new(post_params)
|
57
58
|
humanity_details =
|
@@ -93,13 +94,15 @@ like this:
|
|
93
94
|
NewGoogleRecaptcha.human?(params[:new_google_recaptcha_token], "checkout")
|
94
95
|
```
|
95
96
|
|
97
|
+
### Saving humanity score from Google in your model
|
98
|
+
|
96
99
|
`get_humanity_detailed` method acts like `human?` method, the only difference is that it returns following hash with three key-value pairs:
|
97
100
|
|
98
101
|
- `is_human` - whether actor is a human or not (same as result of `human?` method)
|
99
102
|
- `score` - actual humanity score from recaptcha response
|
100
103
|
- `model` - model which you trying to save
|
101
104
|
|
102
|
-
It could be handy if you want to store score in db or put it into logs or smth else.
|
105
|
+
It could be handy if you want to store score in db or put it into logs or smth else. Real example is above in the code samples.
|
103
106
|
|
104
107
|
Add to your navigation links `data-turbolinks="false"` to make it works with `turbolinks`.
|
105
108
|
|
@@ -222,6 +225,7 @@ You are welcome to contribute.
|
|
222
225
|
* [RoRElessar](https://github.com/RoRElessar)
|
223
226
|
* [rubyconvict](https://github.com/rubyconvict)
|
224
227
|
* [adelnabiullin](https://github.com/adelnabiullin)
|
228
|
+
* [jhill](https://github.com/jhill)
|
225
229
|
|
226
230
|
## License
|
227
231
|
|
@@ -13,7 +13,10 @@ module NewGoogleRecaptcha
|
|
13
13
|
|
14
14
|
def call
|
15
15
|
uri = NewGoogleRecaptcha.compose_uri(token)
|
16
|
-
|
16
|
+
|
17
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
18
|
+
http.use_ssl = true if uri.scheme == 'https'
|
19
|
+
result = JSON.parse(http.request(Net::HTTP::Get.new(uri)).body)
|
17
20
|
|
18
21
|
@score = result['score'].to_f
|
19
22
|
|
@@ -24,4 +27,4 @@ module NewGoogleRecaptcha
|
|
24
27
|
conditions.none?(&:!)
|
25
28
|
end
|
26
29
|
end
|
27
|
-
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: new_google_recaptcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Kasyanchuk
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-02-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- - ">="
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
|
-
description: Google
|
126
|
+
description: Google reCAPTCHA v3 + Rails (integration)
|
127
127
|
email:
|
128
128
|
- igorkasyanchuk@gmail.com
|
129
129
|
executables: []
|
@@ -161,8 +161,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
|
-
rubygems_version: 3.0.
|
164
|
+
rubygems_version: 3.0.6
|
165
165
|
signing_key:
|
166
166
|
specification_version: 4
|
167
|
-
summary: Google
|
167
|
+
summary: Google reCAPTCHA v3 + Rails
|
168
168
|
test_files: []
|