Skip to content

alapiere/prestashop-cloudflare-turnstile

 
 

Repository files navigation

Prestashop Cloudflare Turnstile

Minimum PHP Version Minimum Prestashop Version GitHub release

Presentation

Turnstile is Cloudflare's smart CAPTCHA alternative. The module allows Turnstile to protect your Prestashop forms:

  • Contact
  • Login
  • Register
  • Reset password
  • Checkout Login
  • Checkout Register

Cloudflare Turnstile

Note: Activating a Captcha in the checkout can alter the user experience. A "stupid" bot will rarely reach this stage (cart requirement). To be activated only if necessary.

Requirements

  • Prestashop >= 1.7.6.0
  • PHP >= 7.2.0

Installation

Download the pixel_cloudflare_turnstile.zip file from the last release assets.

Admin

Go to the admin module catalog section and click Upload a module. Select the downloaded zip file.

Manually

Move the downloaded file in the Prestashop modules directory and unzip the archive. Go to the admin module catalog section and search for "Cloudflare Turnstile".

Configuration

  • Sitekey: the sitekey given for the site in your Cloudflare dashboard
  • Secret key: the secret key given for the site in your Cloudflare dashboard
  • Theme: the Turnstile theme (auto, light or dark)
  • Forms to validate: the forms where a Turnstile validation is required

For the registration form, the widget is automatically added with a hook. For "contact", "login" and "reset password" forms, you need to manually add the widget in the template files, usually before the validation button.

Never select a form to validate without the widget in the form template.

Widget

For contact, login and reset password forms, you need to manually add the widget in the template files.

Contact

Template:

themes/{themeName}/modules/contactform/views/templates/widget/contactform.tpl

Widget:

{widget name='pixel_cloudflare_turnstile' form='contact'}

Login

Template:

themes/{themeName}/templates/customer/_partials/login-form.tpl

Widget:

{widget name='pixel_cloudflare_turnstile' form='login'}

Reset password

Template: themes/{themeName}/templates/customer/password-email.tpl Widget:

{widget name='pixel_cloudflare_turnstile' form='password'}

Custom Form

Widget:

{widget name='pixel_cloudflare_turnstile' custom='1' action='custom-form'}

Note: The action param is a free name that will appear in the Turnstile statistics

Testing

Use the following sitekeys and secret keys for testing purposes:

Sitekey

Sitekey Description
1x00000000000000000000AA Always passes
2x00000000000000000000AB Always blocks
3x00000000000000000000FF Forces an interactive challenge

Secret key

Secret key Description
1x0000000000000000000000000000000AA Always passes
2x0000000000000000000000000000000AA Always fails
3x0000000000000000000000000000000AA Yields a "token already spent" error

About

Protect your Prestashop store from spam messages and spam user accounts with Cloudflare Turnstile

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.0%
  • Other 1.0%