recaptcha 1.3.0 → 2.0.0
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 +9 -0
- data/README.md +1 -1
- data/lib/recaptcha.rb +0 -1
- data/lib/recaptcha/client_helper.rb +1 -1
- data/lib/recaptcha/version.rb +1 -1
- metadata +2 -3
- data/lib/recaptcha/token.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c0d1a72cc8afa953bf825eb56110bac7c2504f9
|
4
|
+
data.tar.gz: 8dd5b6d14ec70ff852a331e7f561669c79f89c1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b473d5e4f2e2d44f395b649bfc1f8eb191689e8ceab3ddbd02a2a97de8cf22a601157ac3a59ff5d6aeaa7f333530ffe351a99fd3eb0b7624e11c528db21a12b
|
7
|
+
data.tar.gz: d5b92c45ab72e016bfa6b0052de795a884eba337e456cd4dd89261de46a4f5428bd5aac70e6ae9106fd71794e4afdd7cf3971cad110761a225343396ee36104f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 2.0.0 - 2016-05-17
|
2
|
+
* remove stoken support, must use custom domain verification or domain whitelist
|
3
|
+
|
4
|
+
## 1.3.0 - 2016-04-07
|
5
|
+
* do not set model error and flash
|
6
|
+
|
7
|
+
## 1.2.0 - 2016-04-01
|
8
|
+
* custom domain validation
|
9
|
+
|
1
10
|
## 1.1.0 - 2016-01-27
|
2
11
|
* support RACK_ENV
|
3
12
|
|
data/README.md
CHANGED
@@ -72,8 +72,8 @@ Some of the options available:
|
|
72
72
|
| :ajax | Render the dynamic AJAX captcha per the API. (default `false`)|
|
73
73
|
| :public_key | Override public API key |
|
74
74
|
| :error | Override the error code returned from the reCAPTCHA API (default `nil`)|
|
75
|
-
| :stoken | Include security token to enable the use of any domain without registration with reCAPTCHA, `stoken expired` will be raised when the system clock is out of sync (default `true`)|
|
76
75
|
| :size | Specify a size (default `nil`)|
|
76
|
+
| :hl | Optional. Forces the widget to render in a specific language. Auto-detects the user's language if unspecified. (See [language codes](https://developers.google.com/recaptcha/docs/language)) |
|
77
77
|
|
78
78
|
You can also override the html attributes for the sizes of the generated `textarea` and `iframe`
|
79
79
|
elements, if CSS isn't your thing. Inspect the source of `recaptcha_tags` to see these options.
|
data/lib/recaptcha.rb
CHANGED
@@ -3,6 +3,7 @@ module Recaptcha
|
|
3
3
|
# Your public API can be specified in the +options+ hash or preferably
|
4
4
|
# using the Configuration.
|
5
5
|
def recaptcha_tags(options = {})
|
6
|
+
raise(RecaptchaError, "Secure Token is deprecated.") if options[:stoken]
|
6
7
|
public_key = options[:public_key] || Recaptcha.configuration.public_key!
|
7
8
|
|
8
9
|
script_url = Recaptcha.configuration.api_server_url(ssl: options[:ssl])
|
@@ -14,7 +15,6 @@ module Recaptcha
|
|
14
15
|
a[k] = v if data_attributes.include?(k)
|
15
16
|
end
|
16
17
|
data_attributes[:sitekey] = public_key
|
17
|
-
data_attributes[:stoken] = Recaptcha::Token.secure_token if options[:stoken] != false
|
18
18
|
data_attributes = data_attributes.map { |k,v| %{data-#{k.to_s.tr('_','-')}="#{v}"} }.join(" ")
|
19
19
|
|
20
20
|
html = %{<script src="#{script_url}" async defer></script>\n}
|
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
|
+
version: 2.0.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: 2016-
|
11
|
+
date: 2016-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -150,7 +150,6 @@ files:
|
|
150
150
|
- lib/recaptcha/client_helper.rb
|
151
151
|
- lib/recaptcha/configuration.rb
|
152
152
|
- lib/recaptcha/rails.rb
|
153
|
-
- lib/recaptcha/token.rb
|
154
153
|
- lib/recaptcha/verify.rb
|
155
154
|
- lib/recaptcha/version.rb
|
156
155
|
homepage: http://github.com/ambethia/recaptcha
|
data/lib/recaptcha/token.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'recaptcha'
|
3
|
-
require 'base64'
|
4
|
-
require 'securerandom'
|
5
|
-
require 'openssl'
|
6
|
-
|
7
|
-
module Recaptcha
|
8
|
-
module Token
|
9
|
-
|
10
|
-
def self.secure_token
|
11
|
-
private_key = Recaptcha.configuration.private_key
|
12
|
-
raise RecaptchaError, "No private key specified." unless private_key
|
13
|
-
|
14
|
-
stoken_json = {'session_id' => SecureRandom.uuid, 'ts_ms' => (Time.now.to_f * 1000).to_i}.to_json
|
15
|
-
cipher = OpenSSL::Cipher::AES128.new(:ECB)
|
16
|
-
private_key_digest = Digest::SHA1.digest(private_key)[0...16]
|
17
|
-
|
18
|
-
cipher.encrypt
|
19
|
-
cipher.key = private_key_digest
|
20
|
-
encrypted_stoken = cipher.update(stoken_json) << cipher.final
|
21
|
-
Base64.urlsafe_encode64(encrypted_stoken).gsub(/\=+\Z/, '')
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|