[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorAuthConfirmLinkController 4 extends PhabricatorAuthController { 5 6 private $accountKey; 7 8 public function willProcessRequest(array $data) { 9 $this->accountKey = idx($data, 'akey'); 10 } 11 12 public function processRequest() { 13 $request = $this->getRequest(); 14 $viewer = $request->getUser(); 15 16 $result = $this->loadAccountForRegistrationOrLinking($this->accountKey); 17 list($account, $provider, $response) = $result; 18 19 if ($response) { 20 return $response; 21 } 22 23 if (!$provider->shouldAllowAccountLink()) { 24 return $this->renderError(pht('This account is not linkable.')); 25 } 26 27 $panel_uri = '/settings/panel/external/'; 28 29 if ($request->isFormPost()) { 30 $account->setUserPHID($viewer->getPHID()); 31 $account->save(); 32 33 $this->clearRegistrationCookies(); 34 35 // TODO: Send the user email about the new account link. 36 37 return id(new AphrontRedirectResponse())->setURI($panel_uri); 38 } 39 40 // TODO: Provide more information about the external account. Clicking 41 // through this form blindly is dangerous. 42 43 // TODO: If the user has password authentication, require them to retype 44 // their password here. 45 46 $dialog = id(new AphrontDialogView()) 47 ->setUser($viewer) 48 ->setTitle(pht('Confirm %s Account Link', $provider->getProviderName())) 49 ->addCancelButton($panel_uri) 50 ->addSubmitButton(pht('Confirm Account Link')); 51 52 $form = id(new PHUIFormLayoutView()) 53 ->setFullWidth(true) 54 ->appendChild( 55 phutil_tag( 56 'div', 57 array( 58 'class' => 'aphront-form-instructions', 59 ), 60 pht( 61 'Confirm the link with this %s account. This account will be '. 62 'able to log in to your Phabricator account.', 63 $provider->getProviderName()))) 64 ->appendChild( 65 id(new PhabricatorAuthAccountView()) 66 ->setUser($viewer) 67 ->setExternalAccount($account) 68 ->setAuthProvider($provider)); 69 70 $dialog->appendChild($form); 71 72 $crumbs = $this->buildApplicationCrumbs(); 73 $crumbs->addTextCrumb(pht('Confirm Link'), $panel_uri); 74 $crumbs->addTextCrumb($provider->getProviderName()); 75 76 return $this->buildApplicationPage( 77 array( 78 $crumbs, 79 $dialog, 80 ), 81 array( 82 'title' => pht('Confirm External Account Link'), 83 )); 84 } 85 86 87 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |