recaptcha 4.6.5 → 4.6.6.ruby187
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/recaptcha.rb +3 -2
- data/lib/recaptcha/client_helper.rb +20 -15
- data/lib/recaptcha/rails.rb +3 -8
- data/lib/recaptcha/railtie.rb +15 -0
- data/lib/recaptcha/verify.rb +1 -1
- data/lib/recaptcha/version.rb +1 -1
- metadata +66 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86735f0dcb319674c4c69a5d45d019089eb05e9b
|
4
|
+
data.tar.gz: b4f148df5b3fdc9673d2a3818b299bcdb293f2de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 215f69c8ce408c17d1d0bf32f4ae394b55a36fb4c4a670419689a03abd4dd5bb0ad7085da222ffccb78254437542973d6dea6e1cce130797aa38ed827a176e82
|
7
|
+
data.tar.gz: cdd9851bdb4411a6ede4defb5a0f90a3ee0bd206613d6a0703c8529adeeb56bc0b5f6046f4b544cf72746d01caf4a6ae0b340774fd9e876b5daa708a729366f4
|
data/lib/recaptcha.rb
CHANGED
@@ -3,6 +3,7 @@ require 'recaptcha/client_helper'
|
|
3
3
|
require 'recaptcha/verify'
|
4
4
|
require 'uri'
|
5
5
|
require 'net/http'
|
6
|
+
require 'rack/utils'
|
6
7
|
|
7
8
|
module Recaptcha
|
8
9
|
CONFIG = {
|
@@ -50,7 +51,7 @@ module Recaptcha
|
|
50
51
|
else
|
51
52
|
Net::HTTP
|
52
53
|
end
|
53
|
-
query =
|
54
|
+
query = Rack::Utils.build_query(verify_hash)
|
54
55
|
uri = URI.parse(Recaptcha.configuration.verify_url + '?' + query)
|
55
56
|
http_instance = http.new(uri.host, uri.port)
|
56
57
|
http_instance.read_timeout = http_instance.open_timeout = options[:timeout] || DEFAULT_TIMEOUT
|
@@ -61,7 +62,7 @@ module Recaptcha
|
|
61
62
|
|
62
63
|
def self.i18n(key, default)
|
63
64
|
if defined?(I18n)
|
64
|
-
I18n.translate(key, default
|
65
|
+
I18n.translate(key, :default => default)
|
65
66
|
else
|
66
67
|
default
|
67
68
|
end
|
@@ -48,9 +48,9 @@ module Recaptcha
|
|
48
48
|
|
49
49
|
# Invisible reCAPTCHA implementation
|
50
50
|
def invisible_recaptcha_tags(options = {})
|
51
|
-
options = {callback
|
51
|
+
options = { :callback => 'invisibleRecaptchaSubmit' }.merge(options)
|
52
52
|
text = options.delete(:text)
|
53
|
-
html, tag_attributes = Recaptcha::ClientHelper.recaptcha_components(options
|
53
|
+
html, tag_attributes = Recaptcha::ClientHelper.recaptcha_components(options)
|
54
54
|
html << recaptcha_default_callback if recaptcha_default_callback_required?(options)
|
55
55
|
html << %(<button type="submit" #{tag_attributes}>#{text}</button>\n)
|
56
56
|
html.respond_to?(:html_safe) ? html.html_safe : html
|
@@ -61,27 +61,32 @@ module Recaptcha
|
|
61
61
|
attributes = {}
|
62
62
|
fallback_uri = ""
|
63
63
|
|
64
|
-
|
64
|
+
# Since leftover options get passed directly through as tag
|
65
|
+
# attributes, we must unconditionally delete all our options
|
66
|
+
options = options.dup
|
67
|
+
env = options.delete(:env)
|
68
|
+
class_attribute = options.delete(:class)
|
69
|
+
site_key = options.delete(:site_key)
|
70
|
+
hl = options.delete(:hl).to_s
|
71
|
+
skip_script = (options.delete(:script) == false)
|
72
|
+
data_attributes = {}
|
73
|
+
[:badge, :theme, :type, :callback, :expired_callback, :size, :tabindex].each do |data_attribute|
|
74
|
+
value = options.delete(data_attribute)
|
75
|
+
data_attributes["data-#{data_attribute.to_s.tr('_', '-')}"] = value if value
|
76
|
+
end
|
65
77
|
|
66
|
-
unless Recaptcha::Verify.skip?(
|
67
|
-
site_key
|
68
|
-
hl = options.delete(:hl).to_s
|
78
|
+
unless Recaptcha::Verify.skip?(env)
|
79
|
+
site_key ||= Recaptcha.configuration.site_key!
|
69
80
|
script_url = Recaptcha.configuration.api_server_url
|
70
81
|
script_url += "?hl=#{hl}" unless hl == ""
|
71
|
-
html << %(<script src="#{script_url}" async defer></script>\n) unless
|
82
|
+
html << %(<script src="#{script_url}" async defer></script>\n) unless skip_script
|
72
83
|
fallback_uri = %(#{script_url.chomp(".js")}/fallback?k=#{site_key})
|
73
|
-
|
74
|
-
# Pull out reCaptcha specific data attributes.
|
75
|
-
[:badge, :theme, :type, :callback, :expired_callback, :size, :tabindex].each do |data_attribute|
|
76
|
-
value = options.delete(data_attribute)
|
77
|
-
|
78
|
-
attributes["data-#{data_attribute.to_s.tr('_', '-')}"] = value if value
|
79
|
-
end
|
80
|
-
|
81
84
|
attributes["data-sitekey"] = site_key
|
85
|
+
attributes.merge! data_attributes
|
82
86
|
end
|
83
87
|
|
84
88
|
# Append whatever that's left of options to be attributes on the tag.
|
89
|
+
attributes["class"] = "g-recaptcha #{class_attribute}"
|
85
90
|
tag_attributes = attributes.merge(options).map { |k, v| %(#{k}="#{v}") }.join(" ")
|
86
91
|
|
87
92
|
[html, tag_attributes, fallback_uri]
|
data/lib/recaptcha/rails.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
|
+
require 'net/http'
|
1
2
|
require 'recaptcha'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
initializer :recaptcha do
|
6
|
-
ActionView::Base.send(:include, ::Recaptcha::ClientHelper)
|
7
|
-
ActionController::Base.send(:include, ::Recaptcha::Verify)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
4
|
+
ActionView::Base.send(:include, Recaptcha::ClientHelper)
|
5
|
+
ActionController::Base.send(:include, Recaptcha::Verify)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'recaptcha'
|
3
|
+
|
4
|
+
module Rails
|
5
|
+
module Recaptcha
|
6
|
+
class Railtie < Rails::Railtie
|
7
|
+
initializer "setup config" do
|
8
|
+
begin
|
9
|
+
ActionView::Base.send(:include, ::Recaptcha::ClientHelper)
|
10
|
+
ActionController::Base.send(:include, ::Recaptcha::Verify)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/recaptcha/verify.rb
CHANGED
@@ -5,7 +5,7 @@ module Recaptcha
|
|
5
5
|
# Your private API can be specified in the +options+ hash or preferably
|
6
6
|
# using the Configuration.
|
7
7
|
def verify_recaptcha(options = {})
|
8
|
-
options = {model
|
8
|
+
options = { :model => options } unless options.is_a? Hash
|
9
9
|
return true if Recaptcha::Verify.skip?(options[:env])
|
10
10
|
|
11
11
|
model = options[:model]
|
data/lib/recaptcha/version.rb
CHANGED
metadata
CHANGED
@@ -1,155 +1,169 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recaptcha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.6.ruby187
|
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: 2018-
|
11
|
+
date: 2018-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.8.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.8.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.4.7
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.4.7
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: mocha
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: 1.4.0
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: 1.4.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 0.8.7
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 0.8.7
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: activesupport
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - "
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
75
|
+
version: 2.3.10
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- - "
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: 2.3.10
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: i18n
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- - "
|
87
|
+
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 0.6.11
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- - "
|
94
|
+
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 0.6.11
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: minitest
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- - "
|
101
|
+
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 5.11.3
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- - "
|
108
|
+
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 5.11.3
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: minitest-hooks
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: 1.4.2
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - "
|
122
|
+
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: 1.4.2
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
126
|
+
name: webmock
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
|
-
- - "
|
129
|
+
- - "~>"
|
116
130
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
131
|
+
version: 1.24.6
|
118
132
|
type: :development
|
119
133
|
prerelease: false
|
120
134
|
version_requirements: !ruby/object:Gem::Requirement
|
121
135
|
requirements:
|
122
|
-
- - "
|
136
|
+
- - "~>"
|
123
137
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
138
|
+
version: 1.24.6
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
140
|
+
name: hashdiff
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
128
142
|
requirements:
|
129
|
-
- - "
|
143
|
+
- - "<"
|
130
144
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
145
|
+
version: 0.3.6
|
132
146
|
type: :development
|
133
147
|
prerelease: false
|
134
148
|
version_requirements: !ruby/object:Gem::Requirement
|
135
149
|
requirements:
|
136
|
-
- - "
|
150
|
+
- - "<"
|
137
151
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
152
|
+
version: 0.3.6
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
154
|
+
name: addressable
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
142
156
|
requirements:
|
143
|
-
- - "
|
157
|
+
- - "<"
|
144
158
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
159
|
+
version: 2.4.0
|
146
160
|
type: :development
|
147
161
|
prerelease: false
|
148
162
|
version_requirements: !ruby/object:Gem::Requirement
|
149
163
|
requirements:
|
150
|
-
- - "
|
164
|
+
- - "<"
|
151
165
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
166
|
+
version: 2.4.0
|
153
167
|
description: Helpers for the reCAPTCHA API
|
154
168
|
email:
|
155
169
|
- jasper@ambethia.com
|
@@ -164,6 +178,7 @@ files:
|
|
164
178
|
- lib/recaptcha/client_helper.rb
|
165
179
|
- lib/recaptcha/configuration.rb
|
166
180
|
- lib/recaptcha/rails.rb
|
181
|
+
- lib/recaptcha/railtie.rb
|
167
182
|
- lib/recaptcha/verify.rb
|
168
183
|
- lib/recaptcha/version.rb
|
169
184
|
homepage: http://github.com/ambethia/recaptcha
|
@@ -178,15 +193,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
193
|
requirements:
|
179
194
|
- - ">="
|
180
195
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
196
|
+
version: 1.8.7
|
182
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
198
|
requirements:
|
184
|
-
- - "
|
199
|
+
- - ">"
|
185
200
|
- !ruby/object:Gem::Version
|
186
|
-
version:
|
201
|
+
version: 1.3.1
|
187
202
|
requirements: []
|
188
203
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.
|
204
|
+
rubygems_version: 2.2.2
|
190
205
|
signing_key:
|
191
206
|
specification_version: 4
|
192
207
|
summary: Helpers for the reCAPTCHA API
|