1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 14:00:56 +01:00

Move Recaptcha config to PHP

Summary: Bring these over. Also sort the group list.

Test Plan: Viewed config.

Reviewers: btrahan, codeblock, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2255

Differential Revision: https://secure.phabricator.com/D4338
This commit is contained in:
epriestley 2013-01-03 09:17:38 -08:00
parent 0ecfb75101
commit af604464d7
3 changed files with 42 additions and 0 deletions

View file

@ -1062,6 +1062,7 @@ phutil_register_library_map(array(
'PhabricatorPropertyListExample' => 'applications/uiexample/examples/PhabricatorPropertyListExample.php', 'PhabricatorPropertyListExample' => 'applications/uiexample/examples/PhabricatorPropertyListExample.php',
'PhabricatorPropertyListView' => 'view/layout/PhabricatorPropertyListView.php', 'PhabricatorPropertyListView' => 'view/layout/PhabricatorPropertyListView.php',
'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php', 'PhabricatorQuery' => 'infrastructure/query/PhabricatorQuery.php',
'PhabricatorRecaptchaConfigOptions' => 'applications/config/option/PhabricatorRecaptchaConfigOptions.php',
'PhabricatorRedirectController' => 'applications/base/controller/PhabricatorRedirectController.php', 'PhabricatorRedirectController' => 'applications/base/controller/PhabricatorRedirectController.php',
'PhabricatorRefreshCSRFController' => 'applications/auth/controller/PhabricatorRefreshCSRFController.php', 'PhabricatorRefreshCSRFController' => 'applications/auth/controller/PhabricatorRefreshCSRFController.php',
'PhabricatorRemarkupControl' => 'view/form/control/PhabricatorRemarkupControl.php', 'PhabricatorRemarkupControl' => 'view/form/control/PhabricatorRemarkupControl.php',
@ -2380,6 +2381,7 @@ phutil_register_library_map(array(
'PhabricatorProjectUpdateController' => 'PhabricatorProjectController', 'PhabricatorProjectUpdateController' => 'PhabricatorProjectController',
'PhabricatorPropertyListExample' => 'PhabricatorUIExample', 'PhabricatorPropertyListExample' => 'PhabricatorUIExample',
'PhabricatorPropertyListView' => 'AphrontView', 'PhabricatorPropertyListView' => 'AphrontView',
'PhabricatorRecaptchaConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorRedirectController' => 'PhabricatorController', 'PhabricatorRedirectController' => 'PhabricatorController',
'PhabricatorRefreshCSRFController' => 'PhabricatorAuthController', 'PhabricatorRefreshCSRFController' => 'PhabricatorAuthController',
'PhabricatorRemarkupControl' => 'AphrontFormTextAreaControl', 'PhabricatorRemarkupControl' => 'AphrontFormTextAreaControl',

View file

@ -46,6 +46,7 @@ final class PhabricatorConfigListController
assert_instances_of($groups, 'PhabricatorApplicationConfigOptions'); assert_instances_of($groups, 'PhabricatorApplicationConfigOptions');
$list = new PhabricatorObjectItemListView(); $list = new PhabricatorObjectItemListView();
$groups = msort($groups, 'getName');
foreach ($groups as $group) { foreach ($groups as $group) {
$item = id(new PhabricatorObjectItemView()) $item = id(new PhabricatorObjectItemView())
->setHeader($group->getName()) ->setHeader($group->getName())

View file

@ -0,0 +1,39 @@
<?php
final class PhabricatorRecaptchaConfigOptions
extends PhabricatorApplicationConfigOptions {
public function getName() {
return pht("Integration with Recaptcha");
}
public function getDescription() {
return pht("Configure Recaptcha captchas.");
}
public function getOptions() {
return array(
$this->newOption('recaptcha.enabled', 'bool', false)
->setOptions(
array(
pht("Disable Recaptcha"),
pht("Enable Recaptcha"),
))
->setSummary(pht('Enable captchas with Recaptcha.'))
->setDescription(
pht(
"Enable recaptcha to require users solve captchas after a few ".
"failed login attempts. This hinders brute-force attacks against ".
"user passwords. For more information, see http://recaptcha.net/")),
$this->newOption('recaptcha.public-key', 'string', null)
->setDescription(
pht('Recaptcha public key, obtained by signing up for Recaptcha.')),
$this->newOption('recaptcha.private-key', 'string', null)
->setMasked(true)
->setDescription(
pht('Recaptcha private key, obtained by signing up for Recaptcha.')),
);
}
}