Skip to content

Commit

Permalink
[TASK] Adapt GoogleCaptchaValidator for v13
Browse files Browse the repository at this point in the history
  • Loading branch information
bnf committed Oct 17, 2024
1 parent 3abcbe0 commit 7c4a960
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Classes/Domain/Validator/GoogleCaptchaValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ public function isValid($value): void
$controller = 'Comment';
$settings = GeneralUtility::makeInstance(ConfigurationManagerInterface::class)
->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, 'blog');
$requestData = GeneralUtility::_GPmerged('tx_blog_commentform');
$request = $this->request ?? $GLOBALS['TYPO3_REQUEST'];
$queryArguments = $request->getQueryParams();
$bodyData = $request->getParsedBody();
$requestData = $queryArguments['tx_blog_commentform'] ?? [];

if (
// this validator is called multiple times, if the first success,
Expand All @@ -41,7 +44,7 @@ public function isValid($value): void
'headers' => ['Content-type' => 'application/x-www-form-urlencoded'],
'query' => [
'secret' => $settings['comments']['google_recaptcha']['secret_key'],
'response' => GeneralUtility::_GP('g-recaptcha-response'),
'response' => $bodyData['g-recaptcha-response'] ?? '',
'remoteip' => GeneralUtility::getIndpEnv('REMOTE_ADDR')
]
];
Expand Down

0 comments on commit 7c4a960

Please sign in to comment.