Skip to content

Refactor: update Turnstile field to extend the new security challenge field #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/FormExtension/DonationForm/Fields/TurnstileField.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
namespace GiveCloudflareTurnstile\FormExtension\DonationForm\Fields;

use Give\Framework\FieldsAPI\Concerns\HasLabel;
use Give\Framework\FieldsAPI\Field;
use Give\Framework\FieldsAPI\SecurityChallenge;

/**
* Cloudflare Turnstile field.
* @see https://developers.cloudflare.com/turnstile/get-started/
*
* @unreleased
* @unreleased updated to extend SecurityChallenge
* @since 1.0.0
*/
class TurnstileField extends Field {
class TurnstileField extends SecurityChallenge {
use HasLabel;

const TYPE = 'turnstile';
}
}
8 changes: 4 additions & 4 deletions src/FormExtension/DonationForm/Rules/TurnstileFieldRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@
use GiveCloudflareTurnstile\Turnstile\ValueObjects\TurnstileVerifyResponse;

/**
* @unreleased
* @since 1.0.0
*/
class TurnstileFieldRule implements ValidationRule, ValidatesOnFrontEnd
{

/**
* @unreleased
* @since 1.0.0
*/
public static function id(): string
{
return 'turnstile';
}

/**
* @unreleased
* @since 1.0.0
*/
public static function fromString(string $options = null): ValidationRule
{
return new self();
}

/**
* @unreleased
* @since 1.0.0
*/
public function __invoke($value, Closure $fail, string $key, array $values)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Settings/Actions/RegisterGlobalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
use GiveCloudflareTurnstile\Settings\ValueObjects\SettingKeys;

/**
* @unreleased
* @since 1.0.0
*/
class RegisterGlobalSettings
{
/**
* @unreleased
* @since 1.0.0
*/
public function __invoke(array $settings): array
{
Expand All @@ -22,7 +22,7 @@ public function __invoke(array $settings): array
}

/**
* @unreleased
* @since 1.0.0
*/
protected function getSettings(): array
{
Expand All @@ -42,7 +42,7 @@ protected function getSettings(): array
}

/**
* @unreleased
* @since 1.0.0
*/
public function getEnableSettings(): array
{
Expand Down
Loading