Skip to content

Commit

Permalink
allow other forms to use captchas
Browse files Browse the repository at this point in the history
  • Loading branch information
pryley committed Oct 22, 2024
1 parent 7988c8c commit 98e996e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions plugin/Modules/Captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

class Captcha
{
public function actions(): array
{
return glsr()->filterArray('captcha/actions', [
'submit-review',
]);
}

public function config(): array
{
if (!$this->isEnabled()) {
Expand Down
4 changes: 3 additions & 1 deletion plugin/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use GeminiLabs\SiteReviews\Helpers\Arr;
use GeminiLabs\SiteReviews\Helpers\Cast;
use GeminiLabs\SiteReviews\Helpers\Str;
use GeminiLabs\SiteReviews\Modules\Captcha;
use GeminiLabs\SiteReviews\Modules\Encryption;

class Request extends Arguments
Expand Down Expand Up @@ -58,7 +59,8 @@ public static function inputPost(): Request
if (in_array($action, [glsr()->prefix.'admin_action', glsr()->prefix.'public_action'])) {
$values['_ajax_request'] = true;
}
if ('submit-review' === Helper::filterInput('_action', $values)) {
$requestAction = Helper::filterInput('_action', $values);
if (in_array($requestAction, glsr(Captcha::class)->actions())) {
$values['_frcaptcha'] = Helper::filterInput('frc-captcha-solution');
$values['_hcaptcha'] = Helper::filterInput('h-captcha-response');
$values['_procaptcha'] = Helper::filterInput('procaptcha-response');
Expand Down

0 comments on commit 98e996e

Please sign in to comment.