3 final class PhabricatorAuthSetExternalController
4 extends PhabricatorAuthController
{
6 public function handleRequest(AphrontRequest
$request) {
7 $viewer = $this->getViewer();
9 $configs = id(new PhabricatorAuthProviderConfigQuery())
15 foreach ($configs as $config) {
16 if (!$config->getShouldAllowLink()) {
20 // For now, only buttons get to appear here: for example, we can't
21 // reasonably embed an entire LDAP form into this UI.
22 $provider = $config->getProvider();
23 if (!$provider->isLoginFormAButton()) {
27 $linkable[] = $config;
31 return $this->newDialog()
32 ->setTitle(pht('No Linkable External Providers'))
35 'Currently, there are no configured external auth providers '.
36 'which you can link your account to.'))
37 ->addCancelButton('/');
40 $text = PhabricatorAuthMessage
::loadMessageText(
42 PhabricatorAuthLinkMessageType
::MESSAGEKEY
);
43 if (!phutil_nonempty_string($text)) {
45 'You can link your %s account to an external account to '.
46 'allow you to log in more easily in the future. To continue, choose '.
47 'an account to link below. If you prefer not to link your account, '.
48 'you can skip this step.',
49 PlatformSymbols
::getPlatformServerName());
52 $remarkup_view = new PHUIRemarkupView($viewer, $text);
53 $remarkup_view = phutil_tag(
56 'class' => 'phui-object-box-instructions',
60 PhabricatorCookies
::setClientIDCookie($request);
63 foreach ($configs as $config) {
64 $provider = $config->getProvider();
66 $form = $provider->buildLinkForm($this);
68 if ($provider->isLoginFormAButton()) {
69 require_celerity_resource('auth-css');
73 'class' => 'phabricator-link-button pl',
81 $form = id(new AphrontFormView())
84 id(new AphrontFormSubmitControl())
85 ->addCancelButton('/', pht('Skip This Step')));
87 $header = id(new PHUIHeaderView())
88 ->setHeader(pht('Link External Account'));
90 $box = id(new PHUIObjectBoxView())
93 ->setBackground(PHUIObjectBoxView
::BLUE_PROPERTY
)
94 ->appendChild($remarkup_view)
98 $main_view = id(new PHUITwoColumnView())
101 $crumbs = $this->buildApplicationCrumbs()
102 ->addTextCrumb(pht('Link External Account'))
105 return $this->newPage()
106 ->setTitle(pht('Link External Account'))
108 ->appendChild($main_view);