recaptcha 4.1.0 → 4.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 +24 -0
- data/lib/recaptcha/configuration.rb +4 -3
- data/lib/recaptcha/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 529e90efb6c6981d74f7f1129efbb672e441ca35
|
4
|
+
data.tar.gz: 81e122d8e18de0b1cc4f63ba1651587c18f5bdb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b23f3ce97fb48211958f541a105050ba160a17f6c363634bb8c4aeddf8a161e57c592c96b2fa665e89379b8c84cd9d63415ca5cba7e3ab67aa0757ccdb5d68a0
|
7
|
+
data.tar.gz: 6b7828dd0be7e1317dd82f4130c1cde4a7f51c90890946a2d5ff623da3c863738eb2cad27c29d79e0821393a61792f6b64b9f0d94f892b40e8bc1855d15395ce
|
data/README.md
CHANGED
@@ -99,6 +99,30 @@ Some of the options available:
|
|
99
99
|
| :hostname | Expected hostname or a callable that validates the hostname, see [domain validation](https://developers.google.com/recaptcha/docs/domain_validation) and [hostname](https://developers.google.com/recaptcha/docs/verify#api-response) docs. (default: `nil`, but can be changed by setting `config.hostname`)
|
100
100
|
| :env | Current environment. The request to verify will be skipped if the environment is specified in configuration under `skip_verify_env`
|
101
101
|
|
102
|
+
## invisible_recaptcha_tags
|
103
|
+
|
104
|
+
[Invisible reCAPTCHA](https://developers.google.com/recaptcha/docs/invisible) has two differences:
|
105
|
+
|
106
|
+
1. Needs a callback function, which is called after verification with Google's reCAPTCHA service. This callback function must submit the form.
|
107
|
+
2. The `invisible_recaptcha_tags` generates a submit button.
|
108
|
+
|
109
|
+
```Erb
|
110
|
+
<%= form_for @foo, html: {id: 'invisible-recaptcha-form'} do |f| %>
|
111
|
+
# ... other tags
|
112
|
+
<%= invisible_recaptcha_tags callback: 'submitInvisibleRecaptchaForm' %>
|
113
|
+
<% end %>
|
114
|
+
```
|
115
|
+
|
116
|
+
```Javascript
|
117
|
+
// app/assets/javascripts/application.js
|
118
|
+
var submitInvisibleRecaptchaForm = function () {
|
119
|
+
document.getElementById("invisible-recaptcha-form").submit();
|
120
|
+
};
|
121
|
+
```
|
122
|
+
|
123
|
+
Finally, add `verify_recaptcha` to your controller as seen [above](#rails-installation).
|
124
|
+
|
125
|
+
|
102
126
|
## I18n support
|
103
127
|
reCAPTCHA passes two types of error explanation to a linked model. It will use the I18n gem
|
104
128
|
to translate the default error message if I18n is available. To customize the messages to your locale,
|
@@ -28,7 +28,8 @@ module Recaptcha
|
|
28
28
|
# end
|
29
29
|
#
|
30
30
|
class Configuration
|
31
|
-
attr_accessor :skip_verify_env, :secret_key, :site_key, :
|
31
|
+
attr_accessor :skip_verify_env, :secret_key, :site_key, :api_server_url, :verify_url, :proxy,
|
32
|
+
:handle_timeouts_gracefully, :hostname
|
32
33
|
|
33
34
|
def initialize #:nodoc:
|
34
35
|
@skip_verify_env = %w[test cucumber]
|
@@ -47,11 +48,11 @@ module Recaptcha
|
|
47
48
|
end
|
48
49
|
|
49
50
|
def api_server_url
|
50
|
-
CONFIG.fetch('server_url')
|
51
|
+
@api_server_url || CONFIG.fetch('server_url')
|
51
52
|
end
|
52
53
|
|
53
54
|
def verify_url
|
54
|
-
CONFIG.fetch('verify_url')
|
55
|
+
@verify_url || CONFIG.fetch('verify_url')
|
55
56
|
end
|
56
57
|
end
|
57
58
|
end
|
data/lib/recaptcha/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recaptcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason L Perry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|