Closed tobiasschaeferptb closed 3 years ago
If you have a look at CaptchaService::validateReCaptcha you will quickly see, that it is not possible to get a $status['error'] with value null. If the $response['success'] is false you get one of the messages https://developers.google.com/recaptcha/docs/verify or any of the other error messages that are set in the validateReCaptcha function.
What's more likely is, that the LocalizationUtility::translate does not return anything. Please provide the error that is happeing, so the missing translation can be added.
Hello,
When I click on the captcha checkbox a var_dump($status) shows: array(2) { ["verified"]=> bool(false) ["error"]=> NULL } When I leave the captcha untouched the var_dump($status) shows: array(2) { ["verified"]=> bool(false) ["error"]=> string(22) "missing-input-response" }
Cheers, Tobias
The missing-input-response it so be expected, but the first should not happen if your setup is fitting.
It's important to see what $response contains here https://github.com/evoWeb/recaptcha/blob/4ca4ecf62c8ffe3900c7cbacbdb4a82b9b3461f4/Classes/Services/CaptchaService.php#L182 The NULL would indicate that the queryVerificationServer did not response with error-codes.
var_dump($response); array(0) { }
Looking at the code in queryVerificationServer it is only possible to get an empty response if
GeneralUtility::getUrl($this->configuration['verify_server'] . '?' . $request);
does not get any result. And this is nothing the extension has to cover.
You need to make shure that the Google recaptcha API is accessible and delivers anything.
Hello,
I found the solution for my problem. Our firewall didn't allow the server to access https://www.google.com/recaptcha/api/siteverify (recaptcha parameter verify_server). So it wasn't a bug in recaptcha. But it would suggest that recaptcha would handle such a situation better than throwing an exception.
Cheers, Tobias
There is no way to detect that your installation has a problem, other than to raise an exception to warn you that there is some thing fataly wrong. The extension does it best to make you aware that you need to act. I see no problem here.
Hello,
I'm using sf_register 9.4.1 with recaptcha 9.1.3 on TYPO3 9.5.23. Clicking on the captcha works but when I click create button this exception is thrown: Uncaught TYPO3 Exception: Argument 1 passed to Evoweb\SfRegister\Services\Captcha\AbstractAdapter::addError() must be of the type string, null given, called in typo3conf/ext/recaptcha/Classes/Adapter/SfRegisterAdapter.php on line 81 | TypeError thrown in file typo3conf/ext/sf_register/Classes/Services/Captcha/AbstractAdapter.php in line 65. Within the isValid function it should be: if ($status == false || $status['error'] !== NULL) instead of: if ($status == false || $status['error'] !== '') { since $status['error'] is NULL when the captcha was solved correctly.
Cheers, Tobias