diff --git a/src/Captcha.php b/src/Captcha.php index c00f667..94fcf4f 100644 --- a/src/Captcha.php +++ b/src/Captcha.php @@ -3,6 +3,7 @@ namespace AryehRaber\Captcha; use GuzzleHttp\Client; +use Illuminate\Support\Collection; use Illuminate\Validation\ValidationException; abstract class Captcha @@ -22,7 +23,7 @@ abstract public function getVerificationUrl(); abstract public function getDefaultDisclaimer(); - abstract public function renderIndexTag(); + abstract public function renderIndexTag(Collection $params); abstract public function renderHeadTag(); diff --git a/src/CaptchaTags.php b/src/CaptchaTags.php index be17554..edb59e5 100644 --- a/src/CaptchaTags.php +++ b/src/CaptchaTags.php @@ -23,7 +23,7 @@ public function __construct(Captcha $captcha) */ public function index() { - return $this->captcha->renderIndexTag(); + return $this->captcha->renderIndexTag($this->params); } /** diff --git a/src/Hcaptcha.php b/src/Hcaptcha.php index 64966c0..22c9302 100644 --- a/src/Hcaptcha.php +++ b/src/Hcaptcha.php @@ -2,6 +2,8 @@ namespace AryehRaber\Captcha; +use Illuminate\Support\Collection; + class Hcaptcha extends Captcha { public function getResponseToken() @@ -19,12 +21,12 @@ public function getDefaultDisclaimer() return 'This site is protected by hCaptcha and its Privacy Policy and Terms of Service apply.'; } - public function renderIndexTag() + public function renderIndexTag(Collection $params) { - $attributes = $this->buildAttributes([ + $attributes = $this->buildAttributes($params->merge([ 'data-sitekey' => $this->getSiteKey(), 'data-size' => config('captcha.invisible') ? 'invisible' : '', - ]); + ])); return "
"; } diff --git a/src/Recaptcha.php b/src/Recaptcha.php index c557b12..89e2288 100644 --- a/src/Recaptcha.php +++ b/src/Recaptcha.php @@ -2,6 +2,8 @@ namespace AryehRaber\Captcha; +use Illuminate\Support\Collection; + class Recaptcha extends Captcha { public function getResponseToken() @@ -19,12 +21,12 @@ public function getDefaultDisclaimer() return 'This site is protected by reCAPTCHA and the Google [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms) apply.'; } - public function renderIndexTag() + public function renderIndexTag(Collection $params) { - $attributes = $this->buildAttributes([ + $attributes = $this->buildAttributes($params->merge([ 'data-sitekey' => $this->getSiteKey(), 'data-size' => config('captcha.invisible') ? 'invisible' : '', - ]); + ])); return ""; }