Portfolio_pero/config/recaptcha.php
2026-09-03 13:27:06 +02:00

27 lines
1,003 B
PHP

<?php
/**
* Configuration Google reCAPTCHA v3.
*
* Renseignez vos cles dans config/local.php (ou via variables d'environnement) :
* 'recaptcha_site_key' => 'votre_cle_site',
* 'recaptcha_secret_key' => 'votre_cle_secrete',
* 'recaptcha_min_score' => 0.5, // seuil anti-bot (0.0 = bot, 1.0 = humain)
*
* Tant que les cles ne sont pas renseignees, reCAPTCHA reste desactive
* et le site continue de fonctionner normalement (captcha maths conserve).
*/
require_once __DIR__ . '/bootstrap.php';
if (!defined('RECAPTCHA_SITE_KEY')) {
define('RECAPTCHA_SITE_KEY', trim((string) config_value('recaptcha_site_key', '')));
define('RECAPTCHA_SECRET_KEY', trim((string) config_value('recaptcha_secret_key', '')));
$score = (float) config_value('recaptcha_min_score', 0.5);
if ($score < 0.0 || $score > 1.0) {
$score = 0.5;
}
define('RECAPTCHA_MIN_SCORE', $score);
define('RECAPTCHA_ENABLED', RECAPTCHA_SITE_KEY !== '' && RECAPTCHA_SECRET_KEY !== '');
}