@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add reCaptcha to password registration

Summary: See task

Test Plan:
Attempt to signup with recaptcha disabled.
Attempt to signup with recaptcha enabled with incorrect value.
Attempt to signup with recaptcha enabled with correct value.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Maniphest Tasks: T3832

Differential Revision: https://secure.phabricator.com/D7053

authored by

Gareth Evans and committed by
epriestley
e1892e9b e8205a2d

+18
+18
src/applications/auth/controller/PhabricatorAuthRegisterController.php
··· 123 123 $e_realname = strlen($value_realname) ? null : true; 124 124 $e_email = strlen($value_email) ? null : true; 125 125 $e_password = true; 126 + $e_captcha = true; 126 127 127 128 $min_len = PhabricatorEnv::getEnvConfig('account.minimum-password-length'); 128 129 $min_len = (int)$min_len; 129 130 130 131 if ($request->isFormPost() || !$can_edit_anything) { 131 132 $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); 133 + 134 + if ($must_set_password) { 135 + $e_captcha = pht('Again'); 136 + 137 + $captcha_ok = AphrontFormRecaptchaControl::processCaptcha($request); 138 + if (!$captcha_ok) { 139 + $errors[] = pht("Captcha response is incorrect, try again."); 140 + $e_captcha = pht('Invalid'); 141 + } 142 + } 132 143 133 144 if ($can_edit_username) { 134 145 $value_username = $request->getStr('username'); ··· 326 337 ->setName('realName') 327 338 ->setValue($value_realname) 328 339 ->setError($e_realname)); 340 + } 341 + 342 + if ($must_set_password) { 343 + $form->appendChild( 344 + id(new AphrontFormRecaptchaControl()) 345 + ->setLabel('Captcha') 346 + ->setError($e_captcha)); 329 347 } 330 348 331 349 $submit = id(new AphrontFormSubmitControl());