Skip to content

Commit 5e420b3

Browse files
Joomla 5 captcha fix
1 parent 113d8c6 commit 5e420b3

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

mod_rapid_contact/mod_rapid_contact.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
use \Joomla\CMS\Factory;
1616
use \Joomla\CMS\Helper\ModuleHelper;
17+
use \Joomla\CMS\Captcha\Captcha;
1718

1819
$recipient = $params->get('email_recipient', 'email@email.com');
1920
$wrongantispamanswer = $params->get('wrong_antispam', 'Wrong anti-spam answer');
@@ -43,7 +44,7 @@
4344
}
4445
else if ($params->get('enable_anti_spam', '1') == '2') {
4546
if (Factory::getConfig()->get('captcha') != '0') {
46-
$captcha = JCaptcha::getInstance(Factory::getConfig()->get('captcha'));
47+
$captcha = Captcha::getInstance(Factory::getConfig()->get('captcha'));
4748
try {
4849
if (!$captcha->checkAnswer(Factory::getApplication()->input->get('rp_recaptcha', null, 'string'))) {
4950
$myError = '<span style="color: ' . $error_text_color . ';">' . $wrongantispamanswer . '</span>';

mod_rapid_contact/mod_rapid_contact.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<license>GNU General Public License</license>
88
<authorEmail>mavrosxristoforos@gmail.com</authorEmail>
99
<authorUrl>https://mavrosxristoforos.com/</authorUrl>
10-
<version>1.4.39</version>
10+
<version>1.4.40</version>
1111
<description>Rapid Contact. Lightweight, fast and easy, configuring a contact form, was never a pleasure before.</description>
1212
<files>
1313
<filename module="mod_rapid_contact">mod_rapid_contact.php</filename>

mod_rapid_contact/tmpl/default_anti_spam.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
\defined( '_JEXEC' ) or die( 'Restricted access' );
1414

1515
use \Joomla\CMS\Factory;
16+
use \Joomla\CMS\Captcha\Captcha;
1617

1718
?>
1819
<div class="input-group">
1920
<?php if ($params->get('enable_anti_spam', '1') == '2') { ?>
2021
<?php if (Factory::getConfig()->get('captcha') != '0') {
21-
print JCaptcha::getInstance(Factory::getConfig()->get('captcha'))->display('rp_recaptcha', 'rp_recaptcha', 'g-recaptcha');
22+
print Captcha::getInstance(Factory::getConfig()->get('captcha'))->display('rp_recaptcha', 'rp_recaptcha', 'g-recaptcha');
2223
?>
2324
<input type="hidden" name="<?php print $form_id; ?>'_hasCaptcha" id="<?php print $form_id; ?>_hasCaptcha" value="true"/>
2425
<?php } ?>

0 commit comments

Comments
 (0)