From c73e476e8859ec1341407fe74a9b83835aea1ca1 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 28 Nov 2022 12:36:23 +0100 Subject: [PATCH] Reverted support only for recaptcha v3 v2 & v3 are now both supported --- config.php | 8 +++++-- system/templates/account.create.html.twig | 22 ++++++++++++++++--- system/templates/account.login.html.twig | 19 +++++++++++++--- ...tml.twig => google_recaptcha_v3.html.twig} | 0 templates/tibiacom/account.login.html.twig | 21 ++++++++++++++---- 5 files changed, 58 insertions(+), 12 deletions(-) rename system/templates/{google_recaptcha.html.twig => google_recaptcha_v3.html.twig} (100%) diff --git a/config.php b/config.php index 36eda984..5f6d7706 100644 --- a/config.php +++ b/config.php @@ -135,13 +135,17 @@ $config = array( 'smtp_secure' => '', // What kind of encryption to use on the SMTP connection. Options: '', 'ssl' (GMail) or 'tls' (Microsoft Outlook) 'smtp_debug' => false, // set true to debug (you will see more info in error.log) - // Google reCAPTCHA v3 (prevent spam bots) + // reCAPTCHA (prevent spam bots) 'recaptcha_enabled' => false, // enable recaptcha verification code + 'recaptcha_type' => 'v3', // 'v2-checkbox', 'v2-invisible', 'v3' 'recaptcha_site_key' => '', // get your own site and secret keys at https://www.google.com/recaptcha 'recaptcha_secret_key' => '', + // following option apply only for ReCaptcha v2-checkbox + 'recaptcha_theme' => 'light', // light, dark + // following option apply only for ReCaptcha v3 // min score for validation, between 0 - 1.0 // https://developers.google.com/recaptcha/docs/v3#interpreting_the_score - 'recaptcha_min_score' => 0.5, + 'recaptcha_v3_min_score' => 0.5, // 'generate_new_reckey' => true, // let player generate new recovery key, he will receive e-mail with new rec key (not display on page, hacker can't generate rec key) diff --git a/system/templates/account.create.html.twig b/system/templates/account.create.html.twig index 84be3ac6..b08ba42d 100644 --- a/system/templates/account.create.html.twig +++ b/system/templates/account.create.html.twig @@ -110,7 +110,23 @@ {{ hook('HOOK_ACCOUNT_CREATE_AFTER_PASSWORDS') }} {% if config.recaptcha_enabled %} - + {% if config.recaptcha_type == 'v3' %} + + {% elseif config.recaptcha_type == 'v2-invisible' %} +
+ {% elseif config.recaptcha_type == 'v2-checkbox' %} + + + Verification: + + +
+ + + {% if errors.verification is defined %} + {{ errors.verification }} + {% endif %} + {% endif %} {% endif %} {{ hook('HOOK_ACCOUNT_CREATE_AFTER_RECAPTCHA') }} @@ -329,9 +345,9 @@ {{ hook('HOOK_ACCOUNT_CREATE_AFTER_FORM') }} -{% if config.recaptcha_enabled %} +{% if config.recaptcha_enabled and config.recaptcha_type == 'v3' %} {% set action = 'register' %} - {{ include('google_recaptcha.html.twig') }} + {{ include('google_recaptcha_v3.html.twig') }} {% endif %}