Use Google reCAPTCHA (v2/v3) in your own TYPO3 extensions, EXT:form, EXT:powermail and EXT:formhandler as spam protection.
Do composer require haffner/jh_captcha
in your composer based TYPO3 root.
Download and install the extension from TER.
TYPO3 Extension jh_captcha
Home Page: https://typo3.org/extensions/repository/view/jh_captcha
License: GNU General Public License v2.0
Use Google reCAPTCHA (v2/v3) in your own TYPO3 extensions, EXT:form, EXT:powermail and EXT:formhandler as spam protection.
Do composer require haffner/jh_captcha
in your composer based TYPO3 root.
Download and install the extension from TER.
Describe the bug
On php 8.1 I have PHP Warning: Undefined variable $callBack in jh_captcha/Classes/ViewHelpers/ReCaptchaViewHelper.php line 79
To Reproduce
Steps to reproduce the behavior:
Expected behavior
There is no any php warning :)
Affected versions
Hello! How can I use jh_captcha in felogin? Is it possible?
Describe the bug
Typo3 loads jh_recaptcha fluid template files from the wrong path:
(...)typo3conf/ext/jh_captcha/Resources/Private/Powermail/Partials/Form/Field/JhCaptchaRecaptcha.html
(...)/typo3conf/ext/powermail/Resources/Private/Partials/Form/Field/JhCaptchaRecaptcha.html
Note that I used jh_recaptcha v3.0.3 and the issue is different from #10 .
Is this a configuration problem on my part or a bug?
To Reproduce
Steps to reproduce the behavior:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1225709595: The Fluid template files "/var/www/<removed by schuberttobias>/httpdocs/typo3conf/ext/powermail/Resources/Private/Partials/Form/Field/JhCaptchaRecaptcha.html", "/var/www/<removed by schuberttobias>/httpdocs/typo3conf/ext/powermail/Resources/Private/Partials/Form/Field/JhCaptchaRecaptcha" could not be loaded. | TYPO3Fluid\Fluid\View\Exception\InvalidTemplateResourceException thrown in file /var/www/<removed by schuberttobias>/typo3_src-9.5.19/vendor/typo3fluid/fluid/src/View/TemplatePaths.php in line 730. Requested URL: https://dev.<removed by schuberttobias>/kontakt.html
Expected behavior
Steps 1-4 identical as above
5. Frontend displays the form correctly
Affected versions
Support for 10.4 LTS is not given yet.
The following errors were found while trying to install "jh_captcha":
Your TYPO3 version is higher than this extension requires. It requires TYPO3 versions 8.7.0 - 9.5.99
Would be awesome to have it compatible with TYPO3 11
would be great if you could also output the score when integrating in EXT:form. Then it would be easier to define a suitable score for v3.
It would be good if the extension were added to the translationserver.
Please make a request to the translation team here: https://forge.typo3.org/projects/team-translation/issues
Can you please add async defer
to the api.js script tag?
Currently the js is slowing the page load significantly.
Powermail partial not found on case-sensitive file systems...
Tue, 11 Dec 2018 17:31:15 +0100 [ALERT] request="c6628e87e38c1" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": Oops, an error occurred! Code: 20181211173115adc18810 - {"exception":"TYPO3Fluid\\Fluid\\View\\Exception\\InvalidTemplateResourceException: The Fluid template files \"\/home\/typo3v8\/typo3conf\/ext\/jh_captcha\/Resources\/Private\/Powermail\/Partials\/Form\/Field\/JhCaptchaRecaptcha.html\", \"\/home\/typo3v8\/typo3conf\/ext\/jh_captcha\/Resources\/Private\/Powermail\/Partials\/Form\/Field\/JhCaptchaRecaptcha\", \"\/home\/typo3v8\/typo3conf\/ext\/powermail\/Resources\/Private\/Partials\/Form\/Field\/JhCaptchaRecaptcha.html\", \"\/home\/typo3v8\/typo3conf\/ext\/powermail\/Resources\/Private\/Partials\/Form\/Field\/JhCaptchaRecaptcha\" could not be loaded. in \/home\/typo3v8\/typo3_src-8.7.21\/vendor\/typo3fluid\/fluid\/src\/View\/TemplatePaths.php:730
Describe the bug
did not work for me with: Typo3 9.5.11 and Bootstrap Package https://extensions.typo3.org/extension/bootstrap_package/
To Reproduce
Steps to reproduce the behavior:
Mastertemplate
https://www.bilder-upload.eu/bild-b3d3c9-1574685814.png.html
Template from ContactForm
https://www.bilder-upload.eu/bild-6aeed9-1574691079.png.html
https://www.bilder-upload.eu/bild-a6f831-1574685684.png.html
https://www.bilder-upload.eu/bild-5f0f94-1574685864.png.html
Oops, an error occurred! Code: 201911251334528cc9d495
If I remove reCaptcha from Contact Form, the Contact Form works fine.
Expected behavior
A clear and concise description of what you expected to happen.
Affected versions
Additional context
Add any other context about the problem here.
The badge <div class="grecaptcha-badge">
is shown in the bottom-right corner by default, but this conflicts usually with a scroll-to-top button, so both overlapping each other (an ugly workaround is to move-up the badge by CSS).
The Google reCAPTCHA doc says, it is possible to configure this badge with the options bottomright
, bottomleft
or inline
(the last option will display a "protected by reCAPTCHA" badge inside the form)
Not sure if this option is available also for v3, but at least for v2:
https://developers.google.com/recaptcha/docs/invisible
Thanks!
Check functionality with powermail
Add this to the documentation
Hi there,
when I change v3 secretKey for wrong (invented) and add captcha field to EXT:form, the form is sent anyway.
I try to use a TYPO3 form, which is shown in the frontend very well until I add the ReCaptcha field. Then I see an "Oops, an error occurred!" error in the template, and the log file says:
"Oops, an error occurred! Code: 201812041434354d1ed305 - {"exception":"ReflectionException: Class Haffner\JhCaptcha\Validation\Validator\RecaptchaValidator does not exist ...}
I quess it has something to do with the autoloading or class-map (TYPO3 9.5.1 and jh_captcha 3.0.0).
PS:
During writing this bug-report I found the mistake, its a tiny typo in the file
Configuration/Yaml/ReCaptcha/BaseSetup.yaml
line 22, change the 'c' to capital 'C': Haffner\JhCaptcha\Validation\Validator\ReCaptchaValidator
Describe the bug
We are using this extension together with powermail and its confirmation page. The problem is, that the captcha is validated twice. Once after submitting the form and once after submitting the confirmation page.
There is an if condition at the start of Haffner\JhCaptcha\Validation\Validator\Powermail::spamCheck
, to prevent multiple reCAPTCHA validations, but it's not working.
Also, loading the reCAPTCHA response from the form via GeneralUtility::_GP("g-recaptcha-response")
does not work after submitting the confirmation page, because the parameter "g-recaptcha-response" does not exist in this case.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The reCAPTCHA should only be validated after submitting the confirmation page.
Affected versions
Our suggestion for fixing this bug
Change Haffner\JhCaptcha\Validation\Validator\Powermail::spamCheck
to
public function spamCheck(): bool
{
# Skip captcha check on confirmation page
if (
GeneralUtility::_GPmerged('tx_powermail_pi1')['action'] === 'confirmation' // This has to be "confirmation" not "create".
&& $this->settings['main']['confirmation'] === '1' // We enable the confirmation page via TypoScript. Generally speaking, using $this->settings should be better than using $this->flexForm.
) {
return false;
}
foreach ($this->mail->getAnswers() as $answer) {
if ($answer->getField()->getType() == 'JhCaptchaRecaptcha') {
/** @var ReCaptchaValidator $reCaptchaValidator */
$reCaptchaValidator = GeneralUtility::makeInstance(ReCaptchaValidator::class);
$result = $reCaptchaValidator->validate($answer->getValue()); // Don't read the value from GeneralUtility::_GP, because there are no _GP parameters after submitting the confirmation page.
if (!empty($result->getErrors())) {
return true;
}
}
}
return false;
}
In Resources/Private/Powermail/Partials/Form/Field/JhCaptchaRecaptcha.html
change the view helper call to:
<jhcaptcha:reCaptcha
uid="{f:if(condition: '{field.uid}', then: 'f{field.uid}', else: '')}"
name="tx_powermail_pi1[field][{field.marker}]"
type="powermail"
/>
In Haffner\JhCaptcha\ViewHelpers\ReCaptchaViewHelper::initializeArguments
add
$this->registerArgument('name', 'String', 'Name of the hidden input element', false);
In Haffner\JhCaptcha\ViewHelpers\ReCaptchaViewHelper::renderV3
change the if ($this->isPowermail())
to
if ($this->isPowermail()) {
$name = $this->arguments['name'] ?? 'g-recaptcha-response';
$captchaResponseField = '<input type="hidden" id="' . $captchaResponseId . '" name="' . $name . '">';
}
Thank you very much in advance, for fixing the bug :)
I have problems with jh captcha on typo3 8.7.28 and 9.5.8 / powermail 7.3.1 / jh_captcha 3.0.1
When I fill a form, I can send it even if the captcha is not checked / validated. Have you ever had this problem and have a solution ?
Thank you in advance
Line 22 in jh_captcha/Configuration/Yaml/ReCaptcha/BaseSetup.yaml
implementationClassName: 'Haffner\JhCaptcha\Validation\Validator\RecaptchaValidator'
while the Class is called ReCaptchaValidator
This breaks on Case Sensitive File systems
Reproducable in master and 3.0.1
I'm using last jh_captcha version to integrate reCatcha v2.
Code generated in ReCaptchaViewHelper.php already contains the callback initialisation function.
As mentionned by Google (https://developers.google.com/recaptcha/docs/display) a callback function could be called/defined when the captcha expires (no activity from the user), just adding 'expired-callback': in the grecaptcha.render(...) definition.
Do you think it would be possible to add this feature in future version of the extension?
Thanks a lot for your job.
Regards
Joel
reCAPTCHA v3 returns a score for each request without user friction. The score is based on interactions with your site and enables you to take an appropriate action for your site...
Describe the bug
When implementing jh_captcha in my own extension, I get this error: Validation failed while trying to call ...erController->showAction().
Affected versions
If I remove "Validate" from the model, it works, but the captcha is obviously not validated.
The plugin allows google recaptcha to reload google fonts from google server.
This means that the plugin is no longer legally compliant and the websites that use the plugin can be warned.
Describe the bug
In TYPO3 Extension Repository the latest version is 4.0.0, but the latest release of jh_captcha is 5.0.0
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The latest version available should be 5.0.0
Affected versions
Describe the bug
jh_captcha floods the error log with messages like this:
Tue, 03 Dec 2019 15:48:18 +0100 [WARNING] request="b113352c0c1c4" component="TYPO3.CMS.Frontend.Configuration.TypoScript.ConditionMatching.ConditionMatcher": Expression could not be parsed, fallback kicks in. It looks like an old condition with only one equal sign. - {"expression":"globalVar = LIT:2 = 3"}
To Reproduce
Steps to reproduce the behavior:
Affected versions
Additional context
https://github.com/TehTux/jh_captcha/blob/develop/Configuration/TypoScript/setup.txt#L44
To include ReCaptcha GDPR compliant, its required to avoid loading the script before the user gives consent.
Therefore it's required to change the script tag included by ReCaptchaViewHelper.
In our case (Consentmanager.net) we need to change the src attribute to cmp-src and add some additional attributes.
For V3 this looks like this:
<script type="text/plain" class="cmplazyload" data-cmp-vendor="s1409" data-cmp-src="https://www.google.com/rec..." ></script>But this modification get lost, everytime the extension is updated. So it would be nice, if the script tag is created by an template or an TypoScript setting.
E.G.:
$settings['reCaptcha']['v3']['scriptTagTemplate'] => '<script src="###SRC###" ></script>'
changed to:
$settings['reCaptcha']['v3']['scriptTagTemplate'] => '<script type="text/plain" class="cmplazyload" data-cmp-vendor="s1409" data-cmp-src="###SRC###" ></script>'
Best regards
Bernd
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.