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

Show more information about OAuth tokens in the Account Settings -> External Accounts screen

Summary:
Ref T1536.

- Allow providers to customize the look of external accounts.
- For username/password auth, don't show the account view (it's confusing and not useful).
- For OAuth accounts, show token status.

Test Plan:
{F47374}

{F47375}

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1536

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

+56 -12
+18
src/applications/auth/provider/PhabricatorAuthProvider.php
··· 320 320 return; 321 321 } 322 322 323 + public function willRenderLinkedAccount( 324 + PhabricatorUser $viewer, 325 + PhabricatorObjectItemView $item, 326 + PhabricatorExternalAccount $account) { 327 + 328 + $account_view = id(new PhabricatorAuthAccountView()) 329 + ->setExternalAccount($account) 330 + ->setAuthProvider($this); 331 + 332 + $item->appendChild( 333 + phutil_tag( 334 + 'div', 335 + array( 336 + 'class' => 'mmr mml mst mmb', 337 + ), 338 + $account_view)); 339 + } 340 + 323 341 }
+30
src/applications/auth/provider/PhabricatorAuthProviderOAuth.php
··· 343 343 return null; 344 344 } 345 345 346 + public function willRenderLinkedAccount( 347 + PhabricatorUser $viewer, 348 + PhabricatorObjectItemView $item, 349 + PhabricatorExternalAccount $account) { 350 + 351 + // Get a valid token, possibly refreshing it. 352 + $oauth_token = $this->getOAuthAccessToken($account); 353 + 354 + $item->addAttribute(pht('OAuth2 Account')); 355 + 356 + if ($oauth_token) { 357 + $oauth_expires = $account->getProperty('oauth.token.access.expires'); 358 + if ($oauth_expires) { 359 + $item->addAttribute( 360 + pht( 361 + 'Active OAuth Token (Expires: %s)', 362 + phabricator_datetime($oauth_expires, $viewer))); 363 + } else { 364 + $item->addAttribute( 365 + pht( 366 + 'Active OAuth Token')); 367 + } 368 + } else { 369 + $item->addAttribute(pht('No OAuth Access Token')); 370 + } 371 + 372 + parent::willRenderLinkedAccount($viewer, $item, $account); 373 + } 374 + 375 + 346 376 }
+7
src/applications/auth/provider/PhabricatorAuthProviderPassword.php
··· 239 239 return null; 240 240 } 241 241 242 + public function willRenderLinkedAccount( 243 + PhabricatorUser $viewer, 244 + PhabricatorObjectItemView $item, 245 + PhabricatorExternalAccount $account) { 246 + return; 247 + } 248 + 242 249 }
+1 -12
src/applications/settings/panel/PhabricatorSettingsPanelExternalAccounts.php
··· 77 77 ->setDisabled(!$can_unlink) 78 78 ->setHref('/auth/unlink/'.$account->getProviderKey().'/')); 79 79 80 - $account_view = id(new PhabricatorAuthAccountView()) 81 - ->setExternalAccount($account); 82 - 83 80 if ($provider) { 84 - $account_view->setAuthProvider($provider); 81 + $provider->willRenderLinkedAccount($viewer, $item, $account); 85 82 } 86 - 87 - $item->appendChild( 88 - phutil_tag( 89 - 'div', 90 - array( 91 - 'class' => 'mmr mml mst mmb', 92 - ), 93 - $account_view)); 94 83 95 84 $linked->addItem($item); 96 85 }