recaptcha 3.4.0 → 4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a20fd376758062148a3889f9f705e388c03e7f0
4
- data.tar.gz: 20e4347e487bedfa42d4fac9844ef13582eb88a3
3
+ metadata.gz: 5d7c9ac18ec9de3fed55d8c19fbf4f673a8c1ff8
4
+ data.tar.gz: e303da2bfe6fa08bdd1a41b91629bbba37ea9bf8
5
5
  SHA512:
6
- metadata.gz: e878f44d1a2cd1e83e68ff970a45bda7132aaf6a693df821919bbd1a27da96919b4f90d29687f947b0ab89251ef771bc4638666545884555dee8ecad6e875f91
7
- data.tar.gz: ababd2e302f90d8f52f860a9cd3b83e71a00fac62d0d6f431a4e1a2993d9e74c297ce99e19c1fd255d441b922dad21840ba1c0ca817b92b5765d53fef1709679
6
+ metadata.gz: 9432fbc21f27f050db6ec0463af0b5ef07fb1ea35a0ed32e78ef53748b9aad43b51563603e63d1a86311082da4d1d7cbc72e07240992dc85693327b292036dde
7
+ data.tar.gz: 19a54357999754e6eaec65b4bfbe1ad95dc21122fb90aaa6a71f3cf834a94bbb7442734857b0f8dfcb68bcc09a05dfe5065fc515617e8d28296141e91f51ef5c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 4.0.0 - 2016-11-14
2
+ * public_key -> site_key and private_key -> secret_key
3
+
4
+ ## 3.4.0 - 2016-11-01
5
+ * Update fallback html
6
+
1
7
  ## 3.2.0 - 2016-06-13
2
8
  * remove SKIP_VERIFY_ENV constant, use `skip_verify_env` instance variable instead
3
9
 
data/README.md CHANGED
@@ -25,8 +25,8 @@ Set in production and locally use [dotenv](https://github.com/bkeepers/dotenv),
25
25
  Otherwise see [Alternative API key setup](#alternative-api-key-setup).
26
26
 
27
27
  ```
28
- export RECAPTCHA_PUBLIC_KEY = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
29
- export RECAPTCHA_PRIVATE_KEY = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
28
+ export RECAPTCHA_SITE_KEY = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
29
+ export RECAPTCHA_SECRET_KEY = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
30
30
  ```
31
31
 
32
32
  Add `recaptcha_tags` to the forms you want to protect.
@@ -69,7 +69,7 @@ Some of the options available:
69
69
  | :noscript | Include <noscript> content (default `true`)|
70
70
  | :display | Takes a hash containing the `theme` and `tabindex` options per the API. (default `nil`), options: 'red', 'white', 'blackglass', 'clean', 'custom'|
71
71
  | :ajax | Render the dynamic AJAX captcha per the API. (default `false`)|
72
- | :public_key | Override public API key |
72
+ | :site_key | Override site API key |
73
73
  | :error | Override the error code returned from the reCAPTCHA API (default `nil`)|
74
74
  | :size | Specify a size (default `nil`)|
75
75
  | :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)) |
@@ -93,7 +93,7 @@ Some of the options available:
93
93
  | :model | Model to set errors.
94
94
  | :attribute | Model attribute to receive errors. (default :base)
95
95
  | :message | Custom error message.
96
- | :private_key | Override private API key.
96
+ | :secret_key | Override secret API key.
97
97
  | :timeout | The number of seconds to wait for reCAPTCHA servers before give up. (default `3`)
98
98
  | :response | Custom response parameter. (default: params['g-recaptcha-response'])
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`)
@@ -113,7 +113,7 @@ Also you can translate API response errors to human friendly by adding translati
113
113
  en:
114
114
  recaptcha:
115
115
  errors:
116
- incorrect-captcha-sol: 'Fail'
116
+ verification_failed: 'Fail'
117
117
  ```
118
118
 
119
119
  ## Testing
@@ -131,8 +131,8 @@ Recaptcha.configuration.skip_verify_env.delete("test")
131
131
  ```Ruby
132
132
  # config/initializers/recaptcha.rb
133
133
  Recaptcha.configure do |config|
134
- config.public_key = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
135
- config.private_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
134
+ config.site_key = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
135
+ config.secret_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
136
136
  # Uncomment the following line if you are using a proxy server:
137
137
  # config.proxy = 'http://myproxy.com.au:8080'
138
138
  end
@@ -143,8 +143,8 @@ end
143
143
  For temporary overwrites (not thread safe).
144
144
 
145
145
  ```Ruby
146
- Recaptcha.with_configuration(public_key: '12345') do
147
- # Do stuff with the overwritten public_key.
146
+ Recaptcha.with_configuration(site_key: '12345') do
147
+ # Do stuff with the overwritten site_key.
148
148
  end
149
149
  ```
150
150
 
@@ -153,11 +153,11 @@ end
153
153
  Pass in keys as options at runtime, for code base with multiple reCAPTCHA setups:
154
154
 
155
155
  ```Ruby
156
- recaptcha_tags public_key: '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
156
+ recaptcha_tags site_key: '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
157
157
 
158
158
  and
159
159
 
160
- verify_recaptcha private_key: '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
160
+ verify_recaptcha secret_key: '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
161
161
  ```
162
162
 
163
163
  ## Misc
@@ -10,17 +10,17 @@ module Recaptcha
10
10
  raise(RecaptchaError, "SSL is now always true. Please remove 'ssl' from your calls to recaptcha_tags.")
11
11
  end
12
12
 
13
- public_key = options[:public_key] || Recaptcha.configuration.public_key!
13
+ site_key = options[:site_key] || Recaptcha.configuration.site_key!
14
14
 
15
15
  script_url = Recaptcha.configuration.api_server_url
16
16
  script_url += "?hl=#{options[:hl]}" unless options[:hl].to_s == ""
17
- fallback_uri = "#{script_url.chomp('.js')}/fallback?k=#{public_key}"
17
+ fallback_uri = "#{script_url.chomp('.js')}/fallback?k=#{site_key}"
18
18
 
19
19
  data_attributes = [:theme, :type, :callback, :expired_callback, :size]
20
20
  data_attributes = options.each_with_object({}) do |(k, v), a|
21
21
  a[k] = v if data_attributes.include?(k)
22
22
  end
23
- data_attributes[:sitekey] = public_key
23
+ data_attributes[:sitekey] = site_key
24
24
  tag_attributes = data_attributes.map { |k, v| %(data-#{k.to_s.tr('_', '-')}="#{v}") }.join(" ")
25
25
 
26
26
  if id = options[:id]
@@ -15,7 +15,7 @@ module Recaptcha
15
15
  # Your are able to customize all attributes listed below. All values have
16
16
  # sensitive default and will very likely not need to be changed.
17
17
  #
18
- # Please note that the public and private key for the reCAPTCHA API Access
18
+ # Please note that the site and secret key for the reCAPTCHA API Access
19
19
  # have no useful default value. The keys may be set via the Shell enviroment
20
20
  # or using this configuration. Settings within this configuration always take
21
21
  # precedence.
@@ -23,27 +23,27 @@ module Recaptcha
23
23
  # Setting the keys with this Configuration
24
24
  #
25
25
  # Recaptcha.configure do |config|
26
- # config.public_key = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
27
- # config.private_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
26
+ # config.site_key = '6Lc6BAAAAAAAAChqRbQZcn_yyyyyyyyyyyyyyyyy'
27
+ # config.secret_key = '6Lc6BAAAAAAAAKN3DRm6VA_xxxxxxxxxxxxxxxxx'
28
28
  # end
29
29
  #
30
30
  class Configuration
31
- attr_accessor :skip_verify_env, :private_key, :public_key, :proxy, :handle_timeouts_gracefully, :hostname
31
+ attr_accessor :skip_verify_env, :secret_key, :site_key, :proxy, :handle_timeouts_gracefully, :hostname
32
32
 
33
33
  def initialize #:nodoc:
34
34
  @skip_verify_env = %w[test cucumber]
35
35
  @handle_timeouts_gracefully = HANDLE_TIMEOUTS_GRACEFULLY
36
36
 
37
- @private_key = ENV['RECAPTCHA_PRIVATE_KEY']
38
- @public_key = ENV['RECAPTCHA_PUBLIC_KEY']
37
+ @secret_key = ENV['RECAPTCHA_SECRET_KEY']
38
+ @site_key = ENV['RECAPTCHA_SITE_KEY']
39
39
  end
40
40
 
41
- def private_key!
42
- private_key || raise(RecaptchaError, "No private key specified.")
41
+ def secret_key!
42
+ secret_key || raise(RecaptchaError, "No secret key specified.")
43
43
  end
44
44
 
45
- def public_key!
46
- public_key || raise(RecaptchaError, "No public key specified.")
45
+ def site_key!
46
+ site_key || raise(RecaptchaError, "No site key specified.")
47
47
  end
48
48
 
49
49
  def api_server_url
@@ -62,11 +62,11 @@ module Recaptcha
62
62
  private
63
63
 
64
64
  def recaptcha_verify_via_api_call(request, recaptcha_response, options)
65
- private_key = options[:private_key] || Recaptcha.configuration.private_key!
65
+ secret_key = options[:secret_key] || Recaptcha.configuration.secret_key!
66
66
  remote_ip = (request.respond_to?(:remote_ip) && request.remote_ip) || (env && env['REMOTE_ADDR'])
67
67
 
68
68
  verify_hash = {
69
- "secret" => private_key,
69
+ "secret" => secret_key,
70
70
  "remoteip" => remote_ip.to_s,
71
71
  "response" => recaptcha_response
72
72
  }
@@ -1,3 +1,3 @@
1
1
  module Recaptcha
2
- VERSION = "3.4.0".freeze
2
+ VERSION = "4.0.0".freeze
3
3
  end
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: 3.4.0
4
+ version: 4.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-10-26 00:00:00.000000000 Z
11
+ date: 2016-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
- rubygems_version: 2.5.1
189
+ rubygems_version: 2.4.5.1
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: Helpers for the reCAPTCHA API