_name = 'Recaptcha2'; $this->_privateKey = $privateKey; $this->_publicKey = $publicKey; } public function validateToken(array $post): bool { $token = $post['g-recaptcha-response']; $url = 'https://www.google.com/recaptcha/api/siteverify'; $result = HttpClient::post($url, [ 'secret' => $this->getPrivateKey(), 'response' => $token, ])->json(true); return $result['success'] == 'true'; } public function validateSecret(string $secret) : bool { return true; } public function validateKey(string $key) : bool { return true; // No way to verify } public function getHtml(): string { if (defined('DARK_MODE') && DARK_MODE == 1) { return '
'; } else { return ''; } } public function getJavascriptSource(): string { return 'https://www.google.com/recaptcha/api.js'; } public function getJavascriptSubmit(string $id): ?string { return null; } }