Skip to content
Snippets Groups Projects

Issue #3313475: Add an additional warning to the captcha example page, if the module is not configured

Merged Issue #3313475: Add an additional warning to the captcha example page, if the module is not configured
+ 4
0
@@ -5,6 +5,7 @@
* Friendly Captcha integration module.
*/
use Drupal\Core\Url;
use Drupal\Core\Render\Markup;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Template\Attribute;
@@ -108,6 +109,9 @@ function friendlycaptcha_captcha($op, $captcha_type = '') {
];
}
else {
if (\Drupal::currentUser()->hasPermission('administer friendlycaptcha')) {
\Drupal::messenger()->addWarning(t('Friendly captcha is not configured! Click <a href="@link">here</a> to configure Friendly Captcha. In the meantime challenge type "math" is used as the example fallback.', ['@link' => Url::fromRoute('friendlycaptcha.admin_settings_form')->toString()]));
}
// Fallback to Math captcha as friendlycaptcha is not configured.
$captcha = captcha_captcha('generate', 'Math');
}
Loading