getBool('recaptcha_response_field'); } public static function processCaptcha(AphrontRequest $request) { if (!self::isRecaptchaEnabled()) { return true; } self::requireLib(); $challenge = $request->getStr('recaptcha_challenge_field'); $response = $request->getStr('recaptcha_response_field'); $resp = recaptcha_check_answer( PhabricatorEnv::getEnvConfig('recaptcha.private-key'), $_SERVER['REMOTE_ADDR'], $challenge, $response); return (bool)@$resp->is_valid; } protected function renderInput() { self::requireLib(); $uri = new PhutilURI(PhabricatorEnv::getEnvConfig('phabricator.base-uri')); $protocol = $uri->getProtocol(); $use_ssl = ($protocol == 'https'); return recaptcha_get_html( PhabricatorEnv::getEnvConfig('recaptcha.public-key'), $error = null, $use_ssl); } }