diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index f20c921ed3..66389e579c 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1003,6 +1003,18 @@ phutil_register_library_map(array( 'PhabricatorSearchUserIndexer' => 'applications/search/index/indexer/PhabricatorSearchUserIndexer.php', 'PhabricatorSettingsAdjustController' => 'applications/settings/controller/PhabricatorSettingsAdjustController.php', 'PhabricatorSettingsMainController' => 'applications/settings/controller/PhabricatorSettingsMainController.php', + 'PhabricatorSettingsPanel' => 'applications/settings/panel/PhabricatorSettingsPanel.php', + 'PhabricatorSettingsPanelAccount' => 'applications/settings/panel/PhabricatorSettingsPanelAccount.php', + 'PhabricatorSettingsPanelConduit' => 'applications/settings/panel/PhabricatorSettingsPanelConduit.php', + 'PhabricatorSettingsPanelDisplayPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php', + 'PhabricatorSettingsPanelEmailAddresses' => 'applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php', + 'PhabricatorSettingsPanelEmailPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php', + 'PhabricatorSettingsPanelLDAP' => 'applications/settings/panel/PhabricatorSettingsPanelLDAP.php', + 'PhabricatorSettingsPanelOAuth' => 'applications/settings/panel/PhabricatorSettingsPanelOAuth.php', + 'PhabricatorSettingsPanelPassword' => 'applications/settings/panel/PhabricatorSettingsPanelPassword.php', + 'PhabricatorSettingsPanelProfile' => 'applications/settings/panel/PhabricatorSettingsPanelProfile.php', + 'PhabricatorSettingsPanelSSHKeys' => 'applications/settings/panel/PhabricatorSettingsPanelSSHKeys.php', + 'PhabricatorSettingsPanelSearchPreferences' => 'applications/settings/panel/PhabricatorSettingsPanelSearchPreferences.php', 'PhabricatorSetup' => 'infrastructure/PhabricatorSetup.php', 'PhabricatorSlowvoteChoice' => 'applications/slowvote/storage/PhabricatorSlowvoteChoice.php', 'PhabricatorSlowvoteComment' => 'applications/slowvote/storage/PhabricatorSlowvoteComment.php', @@ -1053,27 +1065,15 @@ phutil_register_library_map(array( 'PhabricatorUITooltipExample' => 'applications/uiexample/examples/PhabricatorUITooltipExample.php', 'PhabricatorUnitsTestCase' => 'view/__tests__/PhabricatorUnitsTestCase.php', 'PhabricatorUser' => 'applications/people/storage/PhabricatorUser.php', - 'PhabricatorUserAccountSettingsPanelController' => 'applications/settings/panel/PhabricatorUserAccountSettingsPanelController.php', - 'PhabricatorUserConduitSettingsPanelController' => 'applications/settings/panel/PhabricatorUserConduitSettingsPanelController.php', 'PhabricatorUserDAO' => 'applications/people/storage/PhabricatorUserDAO.php', 'PhabricatorUserEditor' => 'applications/people/PhabricatorUserEditor.php', 'PhabricatorUserEmail' => 'applications/people/storage/PhabricatorUserEmail.php', - 'PhabricatorUserEmailPreferenceSettingsPanelController' => 'applications/settings/panel/PhabricatorUserEmailPreferenceSettingsPanelController.php', - 'PhabricatorUserEmailSettingsPanelController' => 'applications/settings/panel/PhabricatorUserEmailSettingsPanelController.php', 'PhabricatorUserLDAPInfo' => 'applications/people/storage/PhabricatorUserLDAPInfo.php', - 'PhabricatorUserLDAPSettingsPanelController' => 'applications/settings/panel/PhabricatorUserLDAPSettingsPanelController.php', 'PhabricatorUserLog' => 'applications/people/storage/PhabricatorUserLog.php', 'PhabricatorUserOAuthInfo' => 'applications/people/storage/PhabricatorUserOAuthInfo.php', - 'PhabricatorUserOAuthSettingsPanelController' => 'applications/settings/panel/PhabricatorUserOAuthSettingsPanelController.php', - 'PhabricatorUserPasswordSettingsPanelController' => 'applications/settings/panel/PhabricatorUserPasswordSettingsPanelController.php', - 'PhabricatorUserPreferenceSettingsPanelController' => 'applications/settings/panel/PhabricatorUserPreferenceSettingsPanelController.php', 'PhabricatorUserPreferences' => 'applications/settings/storage/PhabricatorUserPreferences.php', 'PhabricatorUserProfile' => 'applications/people/storage/PhabricatorUserProfile.php', - 'PhabricatorUserProfileSettingsPanelController' => 'applications/settings/panel/PhabricatorUserProfileSettingsPanelController.php', 'PhabricatorUserSSHKey' => 'applications/settings/storage/PhabricatorUserSSHKey.php', - 'PhabricatorUserSSHKeysSettingsPanelController' => 'applications/settings/panel/PhabricatorUserSSHKeysSettingsPanelController.php', - 'PhabricatorUserSearchSettingsPanelController' => 'applications/settings/panel/PhabricatorUserSearchSettingsPanelController.php', - 'PhabricatorUserSettingsPanelController' => 'applications/settings/panel/PhabricatorUserSettingsPanelController.php', 'PhabricatorUserStatus' => 'applications/people/storage/PhabricatorUserStatus.php', 'PhabricatorUserTestCase' => 'applications/people/storage/__tests__/PhabricatorUserTestCase.php', 'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php', @@ -2074,6 +2074,17 @@ phutil_register_library_map(array( 'PhabricatorSearchUserIndexer' => 'PhabricatorSearchDocumentIndexer', 'PhabricatorSettingsAdjustController' => 'PhabricatorController', 'PhabricatorSettingsMainController' => 'PhabricatorController', + 'PhabricatorSettingsPanelAccount' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelConduit' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelDisplayPreferences' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelEmailAddresses' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelEmailPreferences' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelLDAP' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelOAuth' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelPassword' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelProfile' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelSSHKeys' => 'PhabricatorSettingsPanel', + 'PhabricatorSettingsPanelSearchPreferences' => 'PhabricatorSettingsPanel', 'PhabricatorSlowvoteChoice' => 'PhabricatorSlowvoteDAO', 'PhabricatorSlowvoteComment' => 'PhabricatorSlowvoteDAO', 'PhabricatorSlowvoteController' => 'PhabricatorController', @@ -2119,26 +2130,14 @@ phutil_register_library_map(array( 0 => 'PhabricatorUserDAO', 1 => 'PhutilPerson', ), - 'PhabricatorUserAccountSettingsPanelController' => 'PhabricatorUserSettingsPanelController', - 'PhabricatorUserConduitSettingsPanelController' => 'PhabricatorUserSettingsPanelController', 'PhabricatorUserDAO' => 'PhabricatorLiskDAO', 'PhabricatorUserEmail' => 'PhabricatorUserDAO', - 'PhabricatorUserEmailPreferenceSettingsPanelController' => 'PhabricatorUserSettingsPanelController', - 'PhabricatorUserEmailSettingsPanelController' => 'PhabricatorUserSettingsPanelController', 'PhabricatorUserLDAPInfo' => 'PhabricatorUserDAO', - 'PhabricatorUserLDAPSettingsPanelController' => 'PhabricatorUserSettingsPanelController', 'PhabricatorUserLog' => 'PhabricatorUserDAO', 'PhabricatorUserOAuthInfo' => 'PhabricatorUserDAO', - 'PhabricatorUserOAuthSettingsPanelController' => 'PhabricatorUserSettingsPanelController', - 'PhabricatorUserPasswordSettingsPanelController' => 'PhabricatorUserSettingsPanelController', - 'PhabricatorUserPreferenceSettingsPanelController' => 'PhabricatorUserSettingsPanelController', 'PhabricatorUserPreferences' => 'PhabricatorUserDAO', 'PhabricatorUserProfile' => 'PhabricatorUserDAO', - 'PhabricatorUserProfileSettingsPanelController' => 'PhabricatorUserSettingsPanelController', 'PhabricatorUserSSHKey' => 'PhabricatorUserDAO', - 'PhabricatorUserSSHKeysSettingsPanelController' => 'PhabricatorUserSettingsPanelController', - 'PhabricatorUserSearchSettingsPanelController' => 'PhabricatorUserSettingsPanelController', - 'PhabricatorUserSettingsPanelController' => 'PhabricatorPeopleController', 'PhabricatorUserStatus' => 'PhabricatorUserDAO', 'PhabricatorUserTestCase' => 'PhabricatorTestCase', 'PhabricatorWorkerDAO' => 'PhabricatorLiskDAO', diff --git a/src/applications/auth/controller/PhabricatorEmailTokenController.php b/src/applications/auth/controller/PhabricatorEmailTokenController.php index b4e7470929..bd4dfe5cfc 100644 --- a/src/applications/auth/controller/PhabricatorEmailTokenController.php +++ b/src/applications/auth/controller/PhabricatorEmailTokenController.php @@ -97,7 +97,7 @@ final class PhabricatorEmailTokenController $request->setCookie('phsid', $session_key); if (PhabricatorEnv::getEnvConfig('account.editable')) { - $next = (string)id(new PhutilURI('/settings/page/password/')) + $next = (string)id(new PhutilURI('/settings/panel/password/')) ->setQueryParams( array( 'token' => $token, diff --git a/src/applications/auth/controller/PhabricatorLDAPLoginController.php b/src/applications/auth/controller/PhabricatorLDAPLoginController.php index 6b3c1e86da..27cf982fe9 100644 --- a/src/applications/auth/controller/PhabricatorLDAPLoginController.php +++ b/src/applications/auth/controller/PhabricatorLDAPLoginController.php @@ -64,12 +64,12 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { 'another Phabricator account. Before you can link it to a '. 'different LDAP account, you must unlink the old account.
' ); - $dialog->addCancelButton('/settings/page/ldap/'); + $dialog->addCancelButton('/settings/panel/ldap/'); return id(new AphrontDialogResponse())->setDialog($dialog); } else { return id(new AphrontRedirectResponse()) - ->setURI('/settings/page/ldap/'); + ->setURI('/settings/panel/ldap/'); } } @@ -82,7 +82,7 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { $dialog->addHiddenInput('username', $request->getStr('username')); $dialog->addHiddenInput('password', $request->getStr('password')); $dialog->addSubmitButton('Link Accounts'); - $dialog->addCancelButton('/settings/page/ldap/'); + $dialog->addCancelButton('/settings/panel/ldap/'); return id(new AphrontDialogResponse())->setDialog($dialog); } @@ -92,7 +92,7 @@ final class PhabricatorLDAPLoginController extends PhabricatorAuthController { $this->saveLDAPInfo($ldap_info); return id(new AphrontRedirectResponse()) - ->setURI('/settings/page/ldap/'); + ->setURI('/settings/panel/ldap/'); } if ($ldap_info->getID()) { diff --git a/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php b/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php index c793716d5d..4db9b2772c 100644 --- a/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php +++ b/src/applications/auth/controller/PhabricatorLDAPUnlinkController.php @@ -38,7 +38,7 @@ final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController { 'You will not be able to login using this account '. 'once you unlink it. Continue?
'); $dialog->addSubmitButton('Unlink Account'); - $dialog->addCancelButton('/settings/page/ldap/'); + $dialog->addCancelButton('/settings/panel/ldap/'); return id(new AphrontDialogResponse())->setDialog($dialog); } @@ -46,7 +46,7 @@ final class PhabricatorLDAPUnlinkController extends PhabricatorAuthController { $ldap_info->delete(); return id(new AphrontRedirectResponse()) - ->setURI('/settings/page/ldap/'); + ->setURI('/settings/panel/ldap/'); } } diff --git a/src/applications/auth/controller/PhabricatorOAuthLoginController.php b/src/applications/auth/controller/PhabricatorOAuthLoginController.php index d87e7a2cd4..b351aa87f0 100644 --- a/src/applications/auth/controller/PhabricatorOAuthLoginController.php +++ b/src/applications/auth/controller/PhabricatorOAuthLoginController.php @@ -93,13 +93,13 @@ final class PhabricatorOAuthLoginController 'the Phabricator account it is currently linked to.', $provider_name, $provider_name)); - $dialog->addCancelButton('/settings/page/'.$provider_key.'/'); + $dialog->addCancelButton($provider->getSettingsPanelURI()); return id(new AphrontDialogResponse())->setDialog($dialog); } else { $this->saveOAuthInfo($oauth_info); // Refresh token. return id(new AphrontRedirectResponse()) - ->setURI('/settings/page/'.$provider_key.'/'); + ->setURI($provider->getSettingsPanelURI()); } } @@ -119,7 +119,7 @@ final class PhabricatorOAuthLoginController 'must unlink the old account.', $provider_name, $provider_name)); - $dialog->addCancelButton('/settings/page/'.$provider_key.'/'); + $dialog->addCancelButton($provider->getSettingsPanelURI()); return id(new AphrontDialogResponse())->setDialog($dialog); } @@ -136,7 +136,7 @@ final class PhabricatorOAuthLoginController $dialog->addHiddenInput('state', $this->oauthState); $dialog->addHiddenInput('scope', $oauth_info->getTokenScope()); $dialog->addSubmitButton('Link Accounts'); - $dialog->addCancelButton('/settings/page/'.$provider_key.'/'); + $dialog->addCancelButton($provider->getSettingsPanelURI()); return id(new AphrontDialogResponse())->setDialog($dialog); } @@ -146,7 +146,7 @@ final class PhabricatorOAuthLoginController $this->saveOAuthInfo($oauth_info); return id(new AphrontRedirectResponse()) - ->setURI('/settings/page/'.$provider_key.'/'); + ->setURI($provider->getSettingsPanelURI()); } // Login with known auth. diff --git a/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php b/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php index 6d7de0192f..c156c8d55f 100644 --- a/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php +++ b/src/applications/auth/controller/PhabricatorOAuthUnlinkController.php @@ -54,7 +54,7 @@ final class PhabricatorOAuthUnlinkController extends PhabricatorAuthController { 'You will not be able to login using this account '. 'once you unlink it. Continue?
'); $dialog->addSubmitButton('Unlink Account'); - $dialog->addCancelButton('/settings/page/'.$provider_key.'/'); + $dialog->addCancelButton($provider->getSettingsPanelURI()); return id(new AphrontDialogResponse())->setDialog($dialog); } @@ -62,7 +62,7 @@ final class PhabricatorOAuthUnlinkController extends PhabricatorAuthController { $oauth_info->delete(); return id(new AphrontRedirectResponse()) - ->setURI('/settings/page/'.$provider_key.'/'); + ->setURI($provider->getSettingsPanelURI()); } } diff --git a/src/applications/auth/oauth/provider/PhabricatorOAuthProvider.php b/src/applications/auth/oauth/provider/PhabricatorOAuthProvider.php index 33b3a8539c..9f491b0dfd 100644 --- a/src/applications/auth/oauth/provider/PhabricatorOAuthProvider.php +++ b/src/applications/auth/oauth/provider/PhabricatorOAuthProvider.php @@ -38,6 +38,12 @@ abstract class PhabricatorOAuthProvider { abstract public function getAuthURI(); abstract public function getTestURIs(); + public function getSettingsPanelURI() { + $panel = new PhabricatorSettingsPanelOAuth(); + $panel->setOAuthProvider($this); + return $panel->getPanelURI(); + } + /** * If the provider needs extra stuff in the auth request, return it here. * For example, Google needs a response_type parameter. diff --git a/src/applications/differential/view/DifferentialChangesetListView.php b/src/applications/differential/view/DifferentialChangesetListView.php index 7d3005ecb1..ae8ee54f12 100644 --- a/src/applications/differential/view/DifferentialChangesetListView.php +++ b/src/applications/differential/view/DifferentialChangesetListView.php @@ -293,7 +293,7 @@ final class DifferentialChangesetListView extends AphrontView { if ($editor_link) { $meta['editor'] = $editor_link; } else { - $meta['editorConfigure'] = '/settings/page/preferences/'; + $meta['editorConfigure'] = '/settings/panel/display/'; } } diff --git a/src/applications/people/controller/PhabricatorEmailVerificationController.php b/src/applications/people/controller/PhabricatorEmailVerificationController.php index 093ec6d269..8e243356c4 100644 --- a/src/applications/people/controller/PhabricatorEmailVerificationController.php +++ b/src/applications/people/controller/PhabricatorEmailVerificationController.php @@ -51,7 +51,7 @@ final class PhabricatorEmailVerificationController $settings_link = phutil_render_tag( 'a', array( - 'href' => '/settings/page/email/', + 'href' => '/settings/panel/email/', ), 'Return to Email Settings'); $settings_link = ''.$settings_link.'
'; diff --git a/src/applications/people/controller/PhabricatorPeopleProfileController.php b/src/applications/people/controller/PhabricatorPeopleProfileController.php index 3d60cec5ab..8f4a727fd2 100644 --- a/src/applications/people/controller/PhabricatorPeopleProfileController.php +++ b/src/applications/people/controller/PhabricatorPeopleProfileController.php @@ -147,7 +147,7 @@ final class PhabricatorPeopleProfileController if ($user->getPHID() == $viewer->getPHID()) { $nav->addSpacer(); - $nav->addFilter(null, 'Edit Profile...', '/settings/page/profile/'); + $nav->addFilter(null, 'Edit Profile...', '/settings/panel/profile/'); } if ($viewer->getIsAdmin()) { diff --git a/src/applications/settings/application/PhabricatorApplicationSettings.php b/src/applications/settings/application/PhabricatorApplicationSettings.php index f7dfcc73ac..c3b3c92e5a 100644 --- a/src/applications/settings/application/PhabricatorApplicationSettings.php +++ b/src/applications/settings/application/PhabricatorApplicationSettings.php @@ -33,7 +33,7 @@ final class PhabricatorApplicationSettings extends PhabricatorApplication { public function getRoutes() { return array( '/settings/' => array( - '(?:page/(?PReally destroy the old certificate? Any established '. 'sessions will be terminated.'); @@ -52,7 +62,7 @@ final class PhabricatorUserConduitSettingsPanelController $user->setConduitCertificate(null); $user->save(); return id(new AphrontRedirectResponse()) - ->setURI('/settings/page/conduit/?regenerated=true'); + ->setURI($this->getPanelURI('?regenerated=true')); } if ($request->getStr('regenerated')) { @@ -89,7 +99,8 @@ final class PhabricatorUserConduitSettingsPanelController $regen_form = new AphrontFormView(); $regen_form ->setUser($user) - ->setAction('/settings/page/conduit/') + ->setAction($this->getPanelURI()) + ->setWorkflow(true) ->appendChild( '
You can regenerate this '.
'certificate, which will invalidate the old certificate and create '.
@@ -103,12 +114,10 @@ final class PhabricatorUserConduitSettingsPanelController
$regen->appendChild($regen_form);
$regen->setWidth(AphrontPanelView::WIDTH_FORM);
- return id(new AphrontNullView())
- ->appendChild(
- array(
- $notice,
- $cert,
- $regen,
- ));
+ return array(
+ $notice,
+ $cert,
+ $regen,
+ );
}
}
diff --git a/src/applications/settings/panel/PhabricatorUserPreferenceSettingsPanelController.php b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php
similarity index 89%
rename from src/applications/settings/panel/PhabricatorUserPreferenceSettingsPanelController.php
rename to src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php
index 09d5c10ce6..5d78441ca0 100644
--- a/src/applications/settings/panel/PhabricatorUserPreferenceSettingsPanelController.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelDisplayPreferences.php
@@ -16,12 +16,22 @@
* limitations under the License.
*/
-final class PhabricatorUserPreferenceSettingsPanelController
- extends PhabricatorUserSettingsPanelController {
+final class PhabricatorSettingsPanelDisplayPreferences
+ extends PhabricatorSettingsPanel {
- public function processRequest() {
+ public function getPanelKey() {
+ return 'display';
+ }
- $request = $this->getRequest();
+ public function getPanelName() {
+ return pht('Display Preferences');
+ }
+
+ public function getPanelGroup() {
+ return pht('Application Settings');
+ }
+
+ public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
$preferences = $user->loadPreferences();
@@ -44,7 +54,7 @@ final class PhabricatorUserPreferenceSettingsPanelController
$preferences->save();
return id(new AphrontRedirectResponse())
- ->setURI('/settings/page/preferences/?saved=true');
+ ->setURI($this->getPanelURI('?saved=true'));
}
$example_string = << Write something about yourself! '.
'Make sure to include important information like '.
- 'your favorite pokemon and which Starcraft race you play.
'.
'(Default: '.$font_default.')')
->setValue($preferences->getPreference($pref_monospaced)))
->appendChild(
@@ -130,12 +139,10 @@ EXAMPLE;
->setErrors(array('Your preferences have been saved.'));
}
- return id(new AphrontNullView())
- ->appendChild(
- array(
- $error_view,
- $panel,
- ));
+ return array(
+ $error_view,
+ $panel,
+ );
}
}
diff --git a/src/applications/settings/panel/PhabricatorUserEmailSettingsPanelController.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php
similarity index 88%
rename from src/applications/settings/panel/PhabricatorUserEmailSettingsPanelController.php
rename to src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php
index e3af109929..f541d3d5fa 100644
--- a/src/applications/settings/panel/PhabricatorUserEmailSettingsPanelController.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailAddresses.php
@@ -16,14 +16,24 @@
* limitations under the License.
*/
-final class PhabricatorUserEmailSettingsPanelController
- extends PhabricatorUserSettingsPanelController {
+final class PhabricatorSettingsPanelEmailAddresses
+ extends PhabricatorSettingsPanel {
- public function processRequest() {
+ public function getPanelKey() {
+ return 'email';
+ }
- $request = $this->getRequest();
+ public function getPanelName() {
+ return pht('Email Addresses');
+ }
+
+ public function getPanelGroup() {
+ return pht('Email');
+ }
+
+ public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
- $editable = $this->getAccountEditable();
+ $editable = PhabricatorEnv::getEnvConfig('account.editable');
$uri = $request->getRequestURI();
$uri->setQueryParams(array());
@@ -31,23 +41,23 @@ final class PhabricatorUserEmailSettingsPanelController
if ($editable) {
$new = $request->getStr('new');
if ($new) {
- return $this->returnNewAddressResponse($uri, $new);
+ return $this->returnNewAddressResponse($request, $uri, $new);
}
$delete = $request->getInt('delete');
if ($delete) {
- return $this->returnDeleteAddressResponse($uri, $delete);
+ return $this->returnDeleteAddressResponse($request, $uri, $delete);
}
}
$verify = $request->getInt('verify');
if ($verify) {
- return $this->returnVerifyAddressResponse($uri, $verify);
+ return $this->returnVerifyAddressResponse($request, $uri, $verify);
}
$primary = $request->getInt('primary');
if ($primary) {
- return $this->returnPrimaryAddressResponse($uri, $primary);
+ return $this->returnPrimaryAddressResponse($request, $uri, $primary);
}
$emails = id(new PhabricatorUserEmail())->loadAllWhere(
@@ -154,8 +164,11 @@ final class PhabricatorUserEmailSettingsPanelController
return $view;
}
- private function returnNewAddressResponse(PhutilURI $uri, $new) {
- $request = $this->getRequest();
+ private function returnNewAddressResponse(
+ AphrontRequest $request,
+ PhutilURI $uri,
+ $new) {
+
$user = $request->getUser();
$e_email = true;
@@ -234,8 +247,11 @@ final class PhabricatorUserEmailSettingsPanelController
return id(new AphrontDialogResponse())->setDialog($dialog);
}
- private function returnDeleteAddressResponse(PhutilURI $uri, $email_id) {
- $request = $this->getRequest();
+ private function returnDeleteAddressResponse(
+ AphrontRequest $request,
+ PhutilURI $uri,
+ $email_id) {
+
$user = $request->getUser();
// NOTE: You can only delete your own email addresses, and you can not
@@ -273,8 +289,11 @@ final class PhabricatorUserEmailSettingsPanelController
return id(new AphrontDialogResponse())->setDialog($dialog);
}
- private function returnVerifyAddressResponse(PhutilURI $uri, $email_id) {
- $request = $this->getRequest();
+ private function returnVerifyAddressResponse(
+ AphrontRequest $request,
+ PhutilURI $uri,
+ $email_id) {
+
$user = $request->getUser();
// NOTE: You can only send more email for your unverified addresses.
@@ -307,8 +326,11 @@ final class PhabricatorUserEmailSettingsPanelController
return id(new AphrontDialogResponse())->setDialog($dialog);
}
- private function returnPrimaryAddressResponse(PhutilURI $uri, $email_id) {
- $request = $this->getRequest();
+ private function returnPrimaryAddressResponse(
+ AphrontRequest $request,
+ PhutilURI $uri,
+ $email_id) {
+
$user = $request->getUser();
// NOTE: You can only make your own verified addresses primary.
diff --git a/src/applications/settings/panel/PhabricatorUserEmailPreferenceSettingsPanelController.php b/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php
similarity index 95%
rename from src/applications/settings/panel/PhabricatorUserEmailPreferenceSettingsPanelController.php
rename to src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php
index f411636eb7..a3d8d127a5 100644
--- a/src/applications/settings/panel/PhabricatorUserEmailPreferenceSettingsPanelController.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelEmailPreferences.php
@@ -16,11 +16,22 @@
* limitations under the License.
*/
-final class PhabricatorUserEmailPreferenceSettingsPanelController
- extends PhabricatorUserSettingsPanelController {
+final class PhabricatorSettingsPanelEmailPreferences
+ extends PhabricatorSettingsPanel {
- public function processRequest() {
- $request = $this->getRequest();
+ public function getPanelKey() {
+ return 'emailpreferences';
+ }
+
+ public function getPanelName() {
+ return pht('Email Preferences');
+ }
+
+ public function getPanelGroup() {
+ return pht('Email');
+ }
+
+ public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
$preferences = $user->loadPreferences();
@@ -64,7 +75,7 @@ final class PhabricatorUserEmailPreferenceSettingsPanelController
$preferences->save();
return id(new AphrontRedirectResponse())
- ->setURI('/settings/page/emailpref/?saved=true');
+ ->setURI($this->getPanelURI('?saved=true'));
}
$notice = null;
diff --git a/src/applications/settings/panel/PhabricatorUserLDAPSettingsPanelController.php b/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php
similarity index 82%
rename from src/applications/settings/panel/PhabricatorUserLDAPSettingsPanelController.php
rename to src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php
index c422c1db73..c74143058b 100644
--- a/src/applications/settings/panel/PhabricatorUserLDAPSettingsPanelController.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelLDAP.php
@@ -16,12 +16,28 @@
* limitations under the License.
*/
-final class PhabricatorUserLDAPSettingsPanelController
- extends PhabricatorUserSettingsPanelController {
+final class PhabricatorSettingsPanelLDAP
+ extends PhabricatorSettingsPanel {
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
+ public function getPanelKey() {
+ return 'ldap';
+ }
+
+ public function getPanelName() {
+ return pht('LDAP');
+ }
+
+ public function getPanelGroup() {
+ return pht('Linked Accounts');
+ }
+
+ public function isEnabled() {
+ $ldap_provider = new PhabricatorLDAPProvider();
+ return $ldap_provider->isProviderEnabled();
+ }
+
+ public function processRequest(AphrontRequest $request) {
+ $user = $request->getUser();
$ldap_info = id(new PhabricatorUserLDAPInfo())->loadOneWhere(
'userID = %d',
@@ -78,10 +94,8 @@ final class PhabricatorUserLDAPSettingsPanelController
$panel->appendChild($form);
}
- return id(new AphrontNullView())
- ->appendChild(
- array(
- $panel,
- ));
+ return array(
+ $panel,
+ );
}
}
diff --git a/src/applications/settings/panel/PhabricatorUserOAuthSettingsPanelController.php b/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php
similarity index 88%
rename from src/applications/settings/panel/PhabricatorUserOAuthSettingsPanelController.php
rename to src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php
index 031112b9cd..07fa4c6b74 100644
--- a/src/applications/settings/panel/PhabricatorUserOAuthSettingsPanelController.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelOAuth.php
@@ -16,8 +16,37 @@
* limitations under the License.
*/
-final class PhabricatorUserOAuthSettingsPanelController
- extends PhabricatorUserSettingsPanelController {
+final class PhabricatorSettingsPanelOAuth
+ extends PhabricatorSettingsPanel {
+
+ public function getPanelKey() {
+ return 'oauth-'.$this->provider->getProviderKey();
+ }
+
+ public function getPanelName() {
+ return $this->provider->getProviderName();
+ }
+
+ public function getPanelGroup() {
+ return pht('Linked Accounts');
+ }
+
+ public function buildPanels() {
+ $panels = array();
+
+ $providers = PhabricatorOAuthProvider::getAllProviders();
+ foreach ($providers as $provider) {
+ $panel = clone $this;
+ $panel->setOAuthProvider($provider);
+ $panels[] = $panel;
+ }
+
+ return $panels;
+ }
+
+ public function isEnabled() {
+ return $this->provider->isProviderEnabled();
+ }
private $provider;
@@ -48,8 +77,7 @@ final class PhabricatorUserOAuthSettingsPanelController
return $form;
}
- public function processRequest() {
- $request = $this->getRequest();
+ public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
$provider = $this->provider;
$notice = null;
@@ -62,7 +90,7 @@ final class PhabricatorUserOAuthSettingsPanelController
$provider->getProviderKey());
if ($request->isFormPost() && $oauth_info) {
- $notice = $this->refreshProfileImage($oauth_info);
+ $notice = $this->refreshProfileImage($request, $oauth_info);
}
$form = new AphrontFormView();
@@ -198,8 +226,11 @@ final class PhabricatorUserOAuthSettingsPanelController
));
}
- private function refreshProfileImage(PhabricatorUserOAuthInfo $oauth_info) {
- $user = $this->getRequest()->getUser();
+ private function refreshProfileImage(
+ AphrontRequest $request,
+ PhabricatorUserOAuthInfo $oauth_info) {
+
+ $user = $request->getUser();
$provider = $this->provider;
$error = false;
$userinfo_uri = new PhutilURI($provider->getUserInfoURI());
diff --git a/src/applications/settings/panel/PhabricatorUserPasswordSettingsPanelController.php b/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php
similarity index 85%
rename from src/applications/settings/panel/PhabricatorUserPasswordSettingsPanelController.php
rename to src/applications/settings/panel/PhabricatorSettingsPanelPassword.php
index af2e8d9b93..cc086e59f7 100644
--- a/src/applications/settings/panel/PhabricatorUserPasswordSettingsPanelController.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelPassword.php
@@ -16,22 +16,41 @@
* limitations under the License.
*/
-final class PhabricatorUserPasswordSettingsPanelController
- extends PhabricatorUserSettingsPanelController {
+final class PhabricatorSettingsPanelPassword
+ extends PhabricatorSettingsPanel {
- public function processRequest() {
+ public function getPanelKey() {
+ return 'password';
+ }
- $request = $this->getRequest();
- $user = $request->getUser();
- $editable = $this->getAccountEditable();
+ public function getPanelName() {
+ return pht('Password');
+ }
+ public function getPanelGroup() {
+ return pht('Authentication');
+ }
+
+ public function isEnabled() {
// There's no sense in showing a change password panel if the user
- // can't change their password
- if (!$editable ||
- !PhabricatorEnv::getEnvConfig('auth.password-auth-enabled')) {
- return new Aphront400Response();
+ // can't change their password...
+
+ if (!PhabricatorEnv::getEnvConfig('account.editable')) {
+ return false;
}
+ // ...or this install doesn't support password authentication at all.
+
+ if (!PhabricatorEnv::getEnvConfig('auth.password-auth-enabled')) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public function processRequest(AphrontRequest $request) {
+ $user = $request->getUser();
+
$min_len = PhabricatorEnv::getEnvConfig('account.minimum-password-length');
$min_len = (int)$min_len;
@@ -98,7 +117,7 @@ final class PhabricatorUserPasswordSettingsPanelController
// after we update their account.
$next = '/';
} else {
- $next = '/settings/page/password/?saved=true';
+ $next = $this->getPanelURI('?saved=true');
}
return id(new AphrontRedirectResponse())->setURI($next);
@@ -160,11 +179,9 @@ final class PhabricatorUserPasswordSettingsPanelController
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
$panel->appendChild($form);
- return id(new AphrontNullView())
- ->appendChild(
- array(
- $notice,
- $panel,
- ));
+ return array(
+ $notice,
+ $panel,
+ );
}
}
diff --git a/src/applications/settings/panel/PhabricatorUserProfileSettingsPanelController.php b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php
similarity index 92%
rename from src/applications/settings/panel/PhabricatorUserProfileSettingsPanelController.php
rename to src/applications/settings/panel/PhabricatorSettingsPanelProfile.php
index 26f0fa5910..3ef0269611 100644
--- a/src/applications/settings/panel/PhabricatorUserProfileSettingsPanelController.php
+++ b/src/applications/settings/panel/PhabricatorSettingsPanelProfile.php
@@ -16,12 +16,22 @@
* limitations under the License.
*/
-final class PhabricatorUserProfileSettingsPanelController
- extends PhabricatorUserSettingsPanelController {
+final class PhabricatorSettingsPanelProfile
+ extends PhabricatorSettingsPanel {
- public function processRequest() {
+ public function getPanelKey() {
+ return 'profile';
+ }
- $request = $this->getRequest();
+ public function getPanelName() {
+ return pht('Profile');
+ }
+
+ public function getPanelGroup() {
+ return pht('Account Information');
+ }
+
+ public function processRequest(AphrontRequest $request) {
$user = $request->getUser();
$profile = id(new PhabricatorUserProfile())->loadOneWhere(
@@ -95,7 +105,7 @@ final class PhabricatorUserProfileSettingsPanelController
$user->save();
$profile->save();
$response = id(new AphrontRedirectResponse())
- ->setURI('/settings/page/profile/?saved=true');
+ ->setURI($this->getPanelURI('?saved=true'));
return $response;
}
}
@@ -143,7 +153,6 @@ final class PhabricatorUserProfileSettingsPanelController
$form = new AphrontFormView();
$form
->setUser($request->getUser())
- ->setAction('/settings/page/profile/')
->setEncType('multipart/form-data')
->appendChild(
id(new AphrontFormTextControl())
@@ -176,7 +185,7 @@ final class PhabricatorUserProfileSettingsPanelController
->appendChild(
'