Jump to content

KVS 6.2.1 - how to add support for Cloudflare Turnstile captcha


Recommended Posts

Starting from 6.2.1 update we added support for Cloudflare Turnstile captcha in addition to Google reCAPTCHA that was already supported before.

However using Cloudflare Turnstile will need minor template changes. The changes are provided for KVS default theme, but likely they will also work with other themes (from kvs-themes.com) that have support for reCAPTCHA, at least we do not see any potential issues at the moment.

First of all you should check if your theme version has support for reCAPTCHA, otherwise it won't be possible to use Turnstile as well. In order to check that you need to open Website UI -> Page components -> include_footer_general.tpl and check if you have this code block at the bottom:

{{if $recaptcha_site_key!=''}}
....
{{/if}}

If this block is present, then you can follow this guide to add support for Turnstile.

 

How to update a supported theme for Cloudflare Turnstile

Step 1. Update theme JS file from here:

https://kvs-demo.com/static/js/main.min.js

NOTE: this file is minified and it is not expected that you've ever done any custom changes into it. If you did any changes there, they will be lost.

 

Step 2. In Website UI -> Page components -> include_footer_general.tpl replace this block:

{{if $recaptcha_site_key!=''}}
....
{{/if}}

with this:

{{if $recaptcha_site_key!=''}}
  {{if $recaptcha_type=='google'}}
 	<script src="https://www.google.com/recaptcha/api.js?render=explicit"></script>
  {{elseif $recaptcha_type=='cloudflare'}}
  	<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha"></script>
  {{/if}}
{{/if}}

 

Then your theme is ready for Cloudflare Turnstile captcha. You can go to their admin panel and create your site there. This will provide you a pair of Site key and Secret key, similar to Google reCAPTCHA. Input these keys into KVS Captcha plugin and switch to Cloudflare Turnstile. Then check your site's GUI that captcha is working.

  • Like 1
Link to comment
Share on other sites

I have a question and am unsure about something. Maybe you can help.

Do we need to edit only include_footer_general.tpl, or are there other files to be modified, such as in the blocks?

I have yet to update and check the new code responsible for reCAPTCHA.

You have typo in post reCAPCTHA ==> reCAPTCHA

 

 

Link to comment
Share on other sites

21 hours ago, Mich said:

Do we need to edit only include_footer_general.tpl, or are there other files to be modified, such as in the blocks?

If the theme supports reCAPTCHA, then all changes in other places are already there. If it doesn't, this might be very old theme. Unfortunately we can't provide instructions for it, as the process would be very complicated as dozen of places would need to be replaced.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...