diff --git a/app/views/admin/submissions/show.html.erb b/app/views/admin/submissions/show.html.erb
index a0130dd7e..e60b11248 100644
--- a/app/views/admin/submissions/show.html.erb
+++ b/app/views/admin/submissions/show.html.erb
@@ -184,6 +184,14 @@
<%= h(@submission.referer) %>
+
+ |
+ Spam prevention mechanism
+ |
+
+ <%= h(@submission.spam_prevention_mechanism) %>
+ |
+
Language
diff --git a/app/views/components/forms/_custom.html.erb b/app/views/components/forms/_custom.html.erb
index e1214be26..5d876ef15 100644
--- a/app/views/components/forms/_custom.html.erb
+++ b/app/views/components/forms/_custom.html.erb
@@ -107,13 +107,13 @@
<% end %>
<% end %>
- <% if form.enable_turnstile? %>
-
- ">
- <%= hidden_field_tag "cf-turnstile-response", nil %>
-
- <% end %>
<%- if section == form.form_sections.last && !form.suppress_submit_button %>
+ <%- if form.enable_turnstile? %>
+
+
+ <%= hidden_field_tag "cf-turnstile-response", nil %>
+
+ <% end %>
<% end %>
diff --git a/app/views/components/widget/_fba.js.erb b/app/views/components/widget/_fba.js.erb
index 8c9f2dde5..90eb47a2d 100644
--- a/app/views/components/widget/_fba.js.erb
+++ b/app/views/components/widget/_fba.js.erb
@@ -656,7 +656,19 @@ function FBAform(d, N) {
script.src = "https://challenges.cloudflare.com/turnstile/v0/api.js";
script.async = true;
script.defer = true;
- document.head.appendChild(script);
+ script.onload = this.initTurnstile
+ if (!window.turnstile) {
+ document.head.appendChild(script);
+ }
+ },
+ initTurnstile: function() {
+ turnstile.remove("#turnstile-container");
+ turnstile.render("#turnstile-container", {
+ sitekey: "<%= ENV['TURNSTILE_SITE_KEY'] %>",
+ callback: function (token) {
+ document.querySelector("input[name='cf-turnstile-response']").value = token;
+ }
+ });
},
<% end %>
enableLocalStorage: function() {
|