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

Handle user aborts during auth workflows in Phabricator

Summary: Depends on D6872. Ref T3687. Give the user a nice dialog instead of a bare exception.

Test Plan: Cancelled out of Twitter and JIRA workflows. We should probably do this for the OAuth2 workflows too, but they're a bit of a pain to de-auth and I am lazy.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3687

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

+29 -1
+22 -1
src/applications/auth/controller/PhabricatorAuthLoginController.php
··· 25 25 26 26 $provider = $this->provider; 27 27 28 - list($account, $response) = $provider->processLoginRequest($this); 28 + try { 29 + list($account, $response) = $provider->processLoginRequest($this); 30 + } catch (PhutilAuthUserAbortedException $ex) { 31 + if ($viewer->isLoggedIn()) { 32 + // If a logged-in user cancels, take them back to the external accounts 33 + // panel. 34 + $next_uri = '/settings/panel/external/'; 35 + } else { 36 + // If a logged-out user cancels, take them back to the auth start page. 37 + $next_uri = '/'; 38 + } 39 + 40 + // User explicitly hit "Cancel". 41 + $dialog = id(new AphrontDialogView()) 42 + ->setUser($viewer) 43 + ->setTitle(pht('Authentication Canceled')) 44 + ->appendChild( 45 + pht('You canceled authentication.')) 46 + ->addCancelButton($next_uri, pht('Continue')); 47 + return id(new AphrontDialogResponse())->setDialog($dialog); 48 + } 49 + 29 50 if ($response) { 30 51 return $response; 31 52 }
+7
src/applications/auth/provider/PhabricatorAuthProviderOAuth1.php
··· 103 103 return array($account, $response); 104 104 } 105 105 106 + $denied = $request->getStr('denied'); 107 + if (strlen($denied)) { 108 + // Twitter indicates that the user cancelled the login attempt by 109 + // returning "denied" as a parameter. 110 + throw new PhutilAuthUserAbortedException(); 111 + } 112 + 106 113 // NOTE: You can get here via GET, this should probably be a bit more 107 114 // user friendly. 108 115