Skip to content

Commit 2078c4e

Browse files
committed
Add use site_key from Hcaptcha initialization
1 parent 57e918c commit 2078c4e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Hcaptcha.configure do |config|
2+
config.site_key = Rails.application.credentials.hcaptcha[:site_key]
3+
config.secret_key = Rails.application.credentials.hcaptcha[:secret_key]
4+
end

lib/hcaptcha/helpers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def self.hcaptcha(options)
1919
html << %(<div #{tag_attributes}></div>\n)
2020

2121
html << <<-HTML
22-
<div class="h-captcha" data-sitekey="1161d0be-1130-4af5-8999-b6fa8894e2a8"></div>
22+
<div class="h-captcha" data-sitekey="#{Hcaptcha.configuration.site_key!}"></div>
2323
HTML
2424

2525
html.respond_to?(:html_safe) ? html.html_safe : html
@@ -80,7 +80,7 @@ def self.to_message(_key, default)
8080
attributes.merge! data_attributes
8181

8282
# The remaining options will be added as attributes on the tag.
83-
attributes["class"] = "g-hcaptcha #{class_attribute}"
83+
attributes["class"] = "hcaptcha #{class_attribute}"
8484
tag_attributes = attributes.merge(options).map { |k, v| %(#{k}="#{v}") }.join(" ")
8585

8686
[html, tag_attributes]

0 commit comments

Comments
 (0)