Replace reCAPTCHA with Turnstile (#589)

* add laravel turnstile

* add config & settings for turnstile

* publish view to center captcha

* completely replace reCAPTCHA

* update FailedCaptcha event

* add back config for domain verification

* don't set language so browser lang is used
This commit is contained in:
Boy132
2024-11-01 23:15:04 +01:00
committed by GitHub
parent cf57c28c40
commit 9d02aeb130
17 changed files with 372 additions and 136 deletions

View File

@@ -1,31 +0,0 @@
<?php
return [
/*
* Enable or disable captchas
*/
'enabled' => env('RECAPTCHA_ENABLED', true),
/*
* API endpoint for recaptcha checks. You should not edit this.
*/
'domain' => env('RECAPTCHA_DOMAIN', 'https://www.google.com/recaptcha/api/siteverify'),
/*
* Use a custom secret key, we use our public one by default
*/
'secret_key' => env('RECAPTCHA_SECRET_KEY', '6LcJcjwUAAAAALOcDJqAEYKTDhwELCkzUkNDQ0J5'),
'_shipped_secret_key' => '6LcJcjwUAAAAALOcDJqAEYKTDhwELCkzUkNDQ0J5',
/*
* Use a custom website key, we use our public one by default
*/
'website_key' => env('RECAPTCHA_WEBSITE_KEY', '6LcJcjwUAAAAAO_Xqjrtj9wWufUpYRnK6BW8lnfn'),
'_shipped_website_key' => '6LcJcjwUAAAAAO_Xqjrtj9wWufUpYRnK6BW8lnfn',
/*
* Domain verification is enabled by default and compares the domain used when solving the captcha
* as public keys can't have domain verification on google's side enabled (obviously).
*/
'verify_domain' => true,
];

15
config/turnstile.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
return [
'turnstile_enabled' => env('TURNSTILE_ENABLED', false),
'turnstile_site_key' => env('TURNSTILE_SITE_KEY', null),
'turnstile_secret_key' => env('TURNSTILE_SECRET_KEY', null),
'turnstile_verify_domain' => env('TURNSTILE_VERIFY_DOMAIN', true),
'error_messages' => [
'turnstile_check_message' => 'Captcha failed! Please refresh and try again.',
],
];