File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 184184 <%= h ( @submission . referer ) %>
185185 </ td >
186186 </ tr >
187+ < tr >
188+ < td >
189+ Spam prevention mechanism
190+ </ td >
191+ < td >
192+ <%= h ( @submission . spam_prevention_mechanism ) %>
193+ </ td >
194+ </ tr >
187195 < tr >
188196 < td >
189197 Language
Original file line number Diff line number Diff line change 107107 <% end %>
108108 </ div >
109109 <% end %>
110- <% if form . enable_turnstile? %>
111- < div class ="margin-top-2 ">
112- < div class ="cf-turnstile " data-sitekey ="<%= ENV . fetch ( "TURNSTILE_SITE_KEY" , nil ) %> "> </ div >
113- <%= hidden_field_tag "cf-turnstile-response" , nil %>
114- </ div >
115- <% end %>
116110 <%- if section == form . form_sections . last && !form . suppress_submit_button %>
111+ <%- if form . enable_turnstile? %>
112+ < div class ="margin-top-2 ">
113+ < div id ="turnstile-container "> </ div >
114+ <%= hidden_field_tag "cf-turnstile-response" , nil %>
115+ </ div >
116+ <% end %>
117117 < button type ="submit " class ="usa-button submit_form_button "> <%= t 'form.submit' %> </ button >
118118 <% end %>
119119 </ div >
Original file line number Diff line number Diff line change @@ -656,7 +656,19 @@ function FBAform(d, N) {
656656 script.src = "https://challenges.cloudflare.com/turnstile/v0/api.js";
657657 script.async = true;
658658 script.defer = true;
659- document.head.appendChild(script);
659+ script.onload = this.initTurnstile
660+ if (!window.turnstile) {
661+ document.head.appendChild(script);
662+ }
663+ },
664+ initTurnstile: function() {
665+ turnstile.remove("#turnstile-container");
666+ turnstile.render("#turnstile-container", {
667+ sitekey: "<%= ENV['TURNSTILE_SITE_KEY'] %>",
668+ callback: function (token) {
669+ document.querySelector("input[name='cf-turnstile-response']").value = token;
670+ }
671+ });
660672 },
661673 <% end %>
662674 enableLocalStorage: function() {
You can’t perform that action at this time.
0 commit comments