Skip to content

Commit

Permalink
[bugfix] catch different response attribute for prosopo method, resolves
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrawiel committed Dec 2, 2024
1 parent baa82b3 commit 82592ac
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion Classes/Domain/Validator/SpamShield/CaptchaMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ class CaptchaMethod extends AbstractMethod
*/
protected string $captchaMethod = '';

/**
* @var array|array[]
*/
protected array $captchaConfiguration = [
'recaptcha' => [
'siteVerifyUri' => 'https://www.google.com/recaptcha/api/siteverify',
Expand Down Expand Up @@ -134,7 +137,7 @@ protected function verifyCaptchaResponse(): bool

$result = \json_decode($jsonResult);

return (bool)$result->success;
return $this->getExpextedResponseAttribute($result);
}

/**
Expand Down Expand Up @@ -219,6 +222,22 @@ protected function getActionName(): string
return $pluginVariables['action'] ?? '';
}

/**
* @param array|\stdClass $result
*
* @return bool
*/
protected function getExpextedResponseAttribute(array|\stdClass $result): bool {
if($this->configuration['captchaMethod'] === 'procaptcha') {
return $result->status === 'ok' && $result->verified;
}

return (bool)$result->success;
}

/**
* @return RequestInterface|null
*/
protected function getRequest(): ?RequestInterface
{
return $GLOBALS['TYPO3_REQUEST'] ?? null;
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
'author_email' => 'thomas.rawiel@gmail.com',
'state' => 'stable',
'clearCacheOnLoad' => 0,
'version' => '2.1.1',
'version' => '2.1.2',
'constraints' => [
'depends' => [
'typo3' => '12.4.0-12.4.99',
Expand Down

0 comments on commit 82592ac

Please sign in to comment.