File tree Expand file tree Collapse file tree
coderedcms/templates/coderedcms Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 >
2222 {{ button_text|default:page.button_text }}
2323</ button >
24- < script >
25- function recaptchaSubmit ( formId ) {
26- var form = document . getElementById ( formId ) ;
27- if ( form . reportValidity ( ) ) {
28- grecaptcha . ready ( function ( ) {
29- grecaptcha . execute (
30- '{{ ls.recaptcha_public_key }}' ,
31- { action : 'submit' }
32- ) . then ( function ( token ) {
33- // Set value for every token input on the page.
34- document . getElementsByName ( "g-recaptcha-response" ) . forEach (
35- function ( el ) { el . value = token }
36- ) ;
37- var form = document . getElementById ( formId ) ;
38- form . submit ( ) ;
39- } ) ;
40- } ) ;
41- }
42- }
43- </ script >
4424{% else %}
4525< button type ="submit " class ="btn {{page.button_size}} {{page.button_style}} {{page.button_css_class}} ">
4626 {{ button_text|default:page.button_text }}
Original file line number Diff line number Diff line change @@ -191,6 +191,25 @@ <h2 class="text-center my-5">{% trans "Related" %}</h2>
191191 {% with settings.coderedcms.LayoutSettings as ls %}
192192 {% if ls.spam_service == ls.SpamService.RECAPTCHA_V3 %}
193193 < script src ="https://www.google.com/recaptcha/api.js?render={{ ls.recaptcha_public_key }} "> </ script >
194+ < script >
195+ function recaptchaSubmit ( formId ) {
196+ var form = document . getElementById ( formId ) ;
197+ if ( form . reportValidity ( ) ) {
198+ grecaptcha . ready ( function ( ) {
199+ grecaptcha . execute (
200+ '{{ ls.recaptcha_public_key }}' ,
201+ { action : 'submit' }
202+ ) . then ( function ( token ) {
203+ // Set value for every token input on the page.
204+ document . getElementsByName ( "g-recaptcha-response" ) . forEach (
205+ function ( el ) { el . value = token }
206+ ) ;
207+ document . getElementById ( formId ) . submit ( ) ;
208+ } ) ;
209+ } ) ;
210+ }
211+ }
212+ </ script >
194213 {% elif ls.spam_service == ls.SpamService.RECAPTCHA_V2 %}
195214 < script src ="https://www.google.com/recaptcha/api.js "> </ script >
196215 {% endif %}
You can’t perform that action at this time.
0 commit comments