diff --git a/src/view/form/control/AphrontFormRecaptchaControl.php b/src/view/form/control/AphrontFormRecaptchaControl.php index f56dceb50d..ff74eb4bf5 100644 --- a/src/view/form/control/AphrontFormRecaptchaControl.php +++ b/src/view/form/control/AphrontFormRecaptchaControl.php @@ -1,74 +1,78 @@ 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 = false); + $use_ssl); } }