1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 05:42:40 +01:00

Skip captcha when redeeming an invite

Summary: This wasn't actually being skipped for invites; really skip it.

Test Plan:
  - Registered without invite, captcha.
  - Registered with invite, no captcha.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D11877
This commit is contained in:
epriestley 2015-02-24 15:07:44 -08:00
parent e7e67e4481
commit 4e41e164e5

View file

@ -181,6 +181,13 @@ final class PhabricatorAuthRegisterController
$e_password = true; $e_password = true;
$e_captcha = true; $e_captcha = true;
$skip_captcha = false;
if ($invite) {
// If the user is accepting an invite, assume they're trustworthy enough
// that we don't need to CAPTCHA them.
$skip_captcha = true;
}
$min_len = PhabricatorEnv::getEnvConfig('account.minimum-password-length'); $min_len = PhabricatorEnv::getEnvConfig('account.minimum-password-length');
$min_len = (int)$min_len; $min_len = (int)$min_len;
@ -193,7 +200,7 @@ final class PhabricatorAuthRegisterController
if (($request->isFormPost() || !$can_edit_anything) && !$from_invite) { if (($request->isFormPost() || !$can_edit_anything) && !$from_invite) {
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites(); $unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
if ($must_set_password) { if ($must_set_password && !$skip_captcha) {
$e_captcha = pht('Again'); $e_captcha = pht('Again');
$captcha_ok = AphrontFormRecaptchaControl::processCaptcha($request); $captcha_ok = AphrontFormRecaptchaControl::processCaptcha($request);
@ -464,7 +471,7 @@ final class PhabricatorAuthRegisterController
->setError($e_email)); ->setError($e_email));
} }
if ($must_set_password) { if ($must_set_password && !$skip_captcha) {
$form->appendChild( $form->appendChild(
id(new AphrontFormRecaptchaControl()) id(new AphrontFormRecaptchaControl())
->setLabel(pht('Captcha')) ->setLabel(pht('Captcha'))