[ticket/12960] Add warning messages when captcha is disabled or incomplete

PHPBB3-12960
This commit is contained in:
Marc Alexander 2024-04-17 19:55:06 +02:00
parent e333d96eef
commit 3e23839c04
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
3 changed files with 38 additions and 0 deletions

View file

@ -35,6 +35,15 @@
<p>{UPGRADE_INSTRUCTIONS}</p>
</div>
<!-- ENDIF -->
{% if S_CAPTCHA_UNSAFE %}
<div class="errorbox">
<p>{{ lang('CAPTCHA_UNSAFE_WARNING') }}</p>
</div>
{% elseif S_CAPTCHA_INCOMPLETE %}
<div class="errorbox">
<p>{{ lang('CAPTCHA_INCOMPLETE_WARNING') }}</p>
</div>
{% endif %}
<!-- IF S_SEARCH_INDEX_MISSING -->
<div class="errorbox">

View file

@ -641,6 +641,9 @@ class acp_main
}
}
// Warn if incomplete captcha is enabled
$this->check_captcha_type($config, $template);
if (!defined('PHPBB_DISABLE_CONFIG_CHECK'))
{
// World-Writable? (000x)
@ -673,4 +676,27 @@ class acp_main
$this->tpl_name = 'acp_main';
$this->page_title = 'ACP_MAIN';
}
/**
* Check CAPTCHA type and output warning if incomplete type or unsafe config is used
*
* @param \phpbb\config\config $config
* @param \phpbb\template\template $template
* @return void
*/
protected function check_captcha_type(\phpbb\config\config $config, \phpbb\template\template $template): void
{
$template_vars = [];
if (!$config['enable_confirm'])
{
$template_vars['S_CAPTCHA_UNSAFE'] = true;
}
else if ($config['captcha_plugin'] == 'core.captcha.plugins.incomplete')
{
$template_vars['S_CAPTCHA_INCOMPLETE'] = true;
}
$template->assign_vars($template_vars);
}
}

View file

@ -235,6 +235,9 @@ $lang = array_merge($lang, array(
'BACK' => 'Back',
'CAPTCHA_UNSAFE_WARNING' => 'Your board is currently vulnerable to spam submissions because the Spambot countermeasures are either disabled or not configured correctly.',
'CAPTCHA_INCOMPLETE_WARNING' => '“Incomplete Captcha“ is currently enabled. This placeholder CAPTCHA will prevent all form submissions requiring CAPTCHA verification, e.g. user registration. Please configure a proper CAPTCHA solution like Q&amp;A or reCaptcha to ensure intended functionality.',
'CONTAINER_EXCEPTION' => 'phpBB encountered an error building the container due to an installed extension. For this reason, all extensions have been temporarily disabled. Please try purging your forum cache. All extensions will automatically be re-enabled once the container error is resolved. If this error continues, please visit <a href="https://www.phpbb.com/support">phpBB.com</a> for support.',
'EXCEPTION' => 'Exception',