recaptcha 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/recaptcha/client_helper.rb +34 -20
- 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: 275c68afb011d4d29e5ca658017371b578826960
|
4
|
+
data.tar.gz: 0fea70c747d90519985fc733a9423e35fad8bdea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 199a230be03b890f2c937f5edd53760e510c087faed04cb86de8a191fe3bccabfd95434193ec5cf23c350d90c3d62f949d59de2388661fd746ceada639b8aaf8
|
7
|
+
data.tar.gz: c6059bc4929ba3f85cd667efd2a29b08bf2602b409118d8fba8a6635d9988a9f934254f968fed641c29b422911f81ce813663e9e6d4ee4cf5b02f4695898a4f0
|
@@ -10,26 +10,8 @@ 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
|
-
|
14
|
-
|
15
|
-
script_url = Recaptcha.configuration.api_server_url
|
16
|
-
script_url += "?hl=#{options[:hl]}" unless options[:hl].to_s == ""
|
17
|
-
fallback_uri = "#{script_url.chomp('.js')}/fallback?k=#{site_key}"
|
18
|
-
|
19
|
-
data_attributes = [:badge, :theme, :type, :callback, :expired_callback, :size]
|
20
|
-
data_attributes = options.each_with_object({}) do |(k, v), a|
|
21
|
-
a[k] = v if data_attributes.include?(k)
|
22
|
-
end
|
23
|
-
data_attributes[:sitekey] = site_key
|
24
|
-
tag_attributes = data_attributes.map { |k, v| %(data-#{k.to_s.tr('_', '-')}="#{v}") }.join(" ")
|
25
|
-
|
26
|
-
if id = options[:id]
|
27
|
-
tag_attributes << %( id="#{id}")
|
28
|
-
end
|
29
|
-
|
30
|
-
html = ""
|
31
|
-
html << %(<script src="#{script_url}" async defer></script>\n) if options.fetch(:script, true)
|
32
|
-
html << %(<div class="g-recaptcha" #{tag_attributes}></div>\n)
|
13
|
+
html, tag_attributes, fallback_uri = Recaptcha::ClientHelper.recaptcha_components(options)
|
14
|
+
html << %(<div #{tag_attributes}></div>\n)
|
33
15
|
|
34
16
|
if options[:noscript] != false
|
35
17
|
html << <<-HTML
|
@@ -60,5 +42,37 @@ module Recaptcha
|
|
60
42
|
|
61
43
|
html.respond_to?(:html_safe) ? html.html_safe : html
|
62
44
|
end
|
45
|
+
|
46
|
+
# Invisible reCAPTCHA implementation
|
47
|
+
def invisible_recaptcha_tags(options = {})
|
48
|
+
html, tag_attributes = Recaptcha::ClientHelper.recaptcha_components(options)
|
49
|
+
html << %(<button type="submit" #{tag_attributes}>#{options[:text]}</button>\n)
|
50
|
+
html.respond_to?(:html_safe) ? html.html_safe : html
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.recaptcha_components(options = {})
|
54
|
+
site_key = options[:site_key] || Recaptcha.configuration.site_key!
|
55
|
+
script_url = Recaptcha.configuration.api_server_url
|
56
|
+
script_url += "?hl=#{options[:hl]}" unless options[:hl].to_s == ""
|
57
|
+
|
58
|
+
data_attributes = [:badge, :theme, :type, :callback, :expired_callback, :size]
|
59
|
+
data_attributes = options.each_with_object({}) do |(k, v), a|
|
60
|
+
a[k] = v if data_attributes.include?(k)
|
61
|
+
end
|
62
|
+
data_attributes[:sitekey] = site_key
|
63
|
+
|
64
|
+
tag_attributes = data_attributes.map { |k, v| %(data-#{k.to_s.tr('_', '-')}="#{v}") }.join(" ")
|
65
|
+
if id = options[:id]
|
66
|
+
tag_attributes << %( id="#{id}")
|
67
|
+
end
|
68
|
+
tag_attributes << %( class="g-recaptcha #{options[:class]}")
|
69
|
+
|
70
|
+
html = ""
|
71
|
+
html << %(<script src="#{script_url}" async defer></script>\n) if options.fetch(:script, true)
|
72
|
+
|
73
|
+
fallback_uri = "#{script_url.chomp('.js')}/fallback?k=#{site_key}"
|
74
|
+
|
75
|
+
[html, tag_attributes, fallback_uri]
|
76
|
+
end
|
63
77
|
end
|
64
78
|
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.0
|
4
|
+
version: 4.1.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:
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|