@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.

Modularize generation of supplemental login messages

Summary:
Ref T9346. This mostly allows us to give users additional advice based on which instance they are trying to log in to in the Phacility cluster.

It's also slightly more flexible than `auth.login-message` was, and maybe we'll add some more hooks here eventually.

This feels like it's a sidegrade in complexity rather than really an improvement, but not too terrible.

Test Plan:
- Wrote the custom handler in T9346 to replicate old config functionality.
- Wrote a smart handler for Phacility that can provide context-sensitive messages based on which OAuth client you're trying to use.

See new message box at top (implementation in next diff):

{F780375}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9346

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

+59 -11
+2
src/__phutil_library_map__.php
··· 1613 1613 'PhabricatorAuthLinkController' => 'applications/auth/controller/PhabricatorAuthLinkController.php', 1614 1614 'PhabricatorAuthListController' => 'applications/auth/controller/config/PhabricatorAuthListController.php', 1615 1615 'PhabricatorAuthLoginController' => 'applications/auth/controller/PhabricatorAuthLoginController.php', 1616 + 'PhabricatorAuthLoginHandler' => 'applications/auth/handler/PhabricatorAuthLoginHandler.php', 1616 1617 'PhabricatorAuthManagementCachePKCS8Workflow' => 'applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php', 1617 1618 'PhabricatorAuthManagementLDAPWorkflow' => 'applications/auth/management/PhabricatorAuthManagementLDAPWorkflow.php', 1618 1619 'PhabricatorAuthManagementListFactorsWorkflow' => 'applications/auth/management/PhabricatorAuthManagementListFactorsWorkflow.php', ··· 5458 5459 'PhabricatorAuthLinkController' => 'PhabricatorAuthController', 5459 5460 'PhabricatorAuthListController' => 'PhabricatorAuthProviderConfigController', 5460 5461 'PhabricatorAuthLoginController' => 'PhabricatorAuthController', 5462 + 'PhabricatorAuthLoginHandler' => 'Phobject', 5461 5463 'PhabricatorAuthManagementCachePKCS8Workflow' => 'PhabricatorAuthManagementWorkflow', 5462 5464 'PhabricatorAuthManagementLDAPWorkflow' => 'PhabricatorAuthManagementWorkflow', 5463 5465 'PhabricatorAuthManagementListFactorsWorkflow' => 'PhabricatorAuthManagementWorkflow',
+17 -3
src/applications/auth/controller/PhabricatorAuthStartController.php
··· 163 163 $button_columns); 164 164 } 165 165 166 - $login_message = PhabricatorEnv::getEnvConfig('auth.login-message'); 167 - $login_message = phutil_safe_html($login_message); 166 + $handlers = PhabricatorAuthLoginHandler::getAllHandlers(); 167 + 168 + $delegating_controller = $this->getDelegatingController(); 169 + 170 + $header = array(); 171 + foreach ($handlers as $handler) { 172 + $handler = clone $handler; 173 + 174 + $handler->setRequest($request); 175 + 176 + if ($delegating_controller) { 177 + $handler->setDelegatingController($delegating_controller); 178 + } 179 + 180 + $header[] = $handler->getAuthLoginHeaderContent(); 181 + } 168 182 169 183 $invite_message = null; 170 184 if ($invite) { ··· 178 192 return $this->buildApplicationPage( 179 193 array( 180 194 $crumbs, 181 - $login_message, 195 + $header, 182 196 $invite_message, 183 197 $out, 184 198 ),
+36
src/applications/auth/handler/PhabricatorAuthLoginHandler.php
··· 1 + <?php 2 + 3 + abstract class PhabricatorAuthLoginHandler 4 + extends Phobject { 5 + 6 + private $request; 7 + private $delegatingController; 8 + 9 + public function getAuthLoginHeaderContent() { 10 + return array(); 11 + } 12 + 13 + final public function setDelegatingController(AphrontController $controller) { 14 + $this->delegatingController = $controller; 15 + return $this; 16 + } 17 + 18 + final public function getDelegatingController() { 19 + return $this->delegatingController; 20 + } 21 + 22 + final public function setRequest(AphrontRequest $request) { 23 + $this->request = $request; 24 + return $this; 25 + } 26 + 27 + final public function getRequest() { 28 + return $this->request; 29 + } 30 + 31 + final public static function getAllHandlers() { 32 + return id(new PhutilClassMapQuery()) 33 + ->setAncestorClass(__CLASS__) 34 + ->execute(); 35 + } 36 + }
+4
src/applications/config/check/PhabricatorExtraConfigSetupCheck.php
··· 276 276 'Impersonating users over the API is no longer supported.'), 277 277 278 278 'feed.public' => pht('The framable public feed is no longer supported.'), 279 + 280 + 'auth.login-message' => pht( 281 + 'This configuration option has been replaced with a modular '. 282 + 'handler. See T9346.'), 279 283 ); 280 284 281 285 return $ancient_config;
-8
src/applications/config/option/PhabricatorAuthenticationConfigOptions.php
··· 73 73 ->addExample( 74 74 "yourcompany.com\nmail.yourcompany.com", 75 75 pht('Valid Setting')), 76 - $this->newOption('auth.login-message', 'string', null) 77 - ->setLocked(true) 78 - ->setSummary(pht('A block of HTML displayed on the login screen.')) 79 - ->setDescription( 80 - pht( 81 - "You can provide an arbitrary block of HTML here, which will ". 82 - "appear on the login screen. Normally, you'd use this to provide ". 83 - "login or registration instructions to users.")), 84 76 $this->newOption('account.editable', 'bool', true) 85 77 ->setBoolOptions( 86 78 array(