getRequest(); $user = $request->getUser(); $ldap_info = id(new PhabricatorUserLDAPInfo())->loadOneWhere( 'userID = %d', $user->getID()); $forms = array(); if (!$ldap_info) { $unlink = 'Link LDAP Account'; $unlink_form = new AphrontFormView(); $unlink_form ->setUser($user) ->setAction('/ldap/login/') ->appendChild( '
There is currently no '. 'LDAP account linked to your Phabricator account. You can link an ' . 'account, which will allow you to use it to log into Phabricator
') ->appendChild( id(new AphrontFormTextControl()) ->setLabel('LDAP username') ->setName('username')) ->appendChild( id(new AphrontFormPasswordControl()) ->setLabel('Password') ->setName('password')) ->appendChild( id(new AphrontFormSubmitControl()) ->setValue("Link LDAP Account \xC2\xBB")); $forms['Link Account'] = $unlink_form; } else { $unlink = 'Unlink LDAP Account'; $unlink_form = new AphrontFormView(); $unlink_form ->setUser($user) ->appendChild( 'You may unlink this account '. 'from your LDAP account. This will prevent you from logging in with '. 'your LDAP credentials.
') ->appendChild( id(new AphrontFormSubmitControl()) ->addCancelButton('/ldap/unlink/', $unlink)); $forms['Unlink Account'] = $unlink_form; } $panel = new AphrontPanelView(); $panel->setHeader('LDAP Account Settings'); $panel->setWidth(AphrontPanelView::WIDTH_FORM); foreach ($forms as $name => $form) { if ($name) { $panel->appendChild('