responseField()] ?? null;
if (empty($token)) {
return false;
}
$cap = new Cap(app(HttpFactory::class), [
'endpoint' => config_cache('captcha.cap.endpoint'),
'secret' => config_cache('captcha.cap.secret'),
'timeout' => (int) config('captcha.cap.timeout', 5),
'fail_open' => (bool) config('captcha.cap.fail_open', false),
]);
return $cap->verify((string) $token);
}
public function render(array $attributes = []): string
{
$endpoint = e((string) config_cache('captcha.cap.endpoint'));
$field = e($this->responseField());
$attrs = '';
foreach ($attributes as $key => $value) {
$attrs .= ' '.e($key).'="'.e($value).'"';
}
return '';
}
public function scripts(): string
{
// Load the widget from the jsDelivr CDN. Defaults to the "latest"
// stable release; pin a specific version via captcha.cap.widget_version.
$version = trim((string) config('captcha.cap.widget_version')) ?: self::DEFAULT_WIDGET_VERSION;
$src = 'https://cdn.jsdelivr.net/npm/@cap.js/widget@'.$version;
return '';
}
}