diff --git a/src/applications/people/controller/settings/PhabricatorUserSettingsController.php b/src/applications/people/controller/settings/PhabricatorUserSettingsController.php index e22fe43913..c131b69cc1 100644 --- a/src/applications/people/controller/settings/PhabricatorUserSettingsController.php +++ b/src/applications/people/controller/settings/PhabricatorUserSettingsController.php @@ -171,18 +171,43 @@ class PhabricatorUserSettingsController extends PhabricatorPeopleController { $notice = null; } + $host = PhabricatorEnv::getEnvConfig('phabricator.base-uri') . 'api/'; + $conduit_setting = sprintf( + ' %s: {'."\n". + ' "user" : %s,'."\n". + ' "cert" : %s'."\n". + ' }'."\n", + json_encode($host), + json_encode($user->getUserName()), + json_encode($user->getConduitCertificate())); + $cert_form = new AphrontFormView(); $cert_form ->setUser($user) ->appendChild( - '

Copy and paste this certificate '. - 'into your ~/.arcrc in the "hosts" section to enable '. - 'Arcanist to authenticate against this host.

') + '

Copy and paste the host info '. + 'including the certificate into your ~/.arcrc in the "hosts" '. + 'session to enable Arcanist to authenticate against this host.

') + ->appendChild( + id(new AphrontFormMarkupControl()) + ->setControlStyle('white-space: pre; font-family: monospace') + ->setValue( + '{'."\n". + ' ...'."\n". + ' "hosts" : {'."\n")) ->appendChild( id(new AphrontFormTextAreaControl()) - ->setLabel('Certificate') + ->setLabel('Credentials') ->setHeight(AphrontFormTextAreaControl::HEIGHT_SHORT) - ->setValue($user->getConduitCertificate())); + ->setControlStyle('font-family: monospace') + ->setValue($conduit_setting)) + ->appendChild( + id(new AphrontFormStaticControl()) + ->setControlStyle('white-space: pre; font-family: monospace') + ->setValue( + ' }'."\n". + ' ...'."\n". + '}')); $cert = new AphrontPanelView(); $cert->setHeader('Arcanist Certificate'); diff --git a/src/applications/people/controller/settings/__init__.php b/src/applications/people/controller/settings/__init__.php index 1e8da4987f..c55f697c06 100644 --- a/src/applications/people/controller/settings/__init__.php +++ b/src/applications/people/controller/settings/__init__.php @@ -24,7 +24,6 @@ phutil_require_module('phabricator', 'view/form/control/markup'); phutil_require_module('phabricator', 'view/form/control/static'); phutil_require_module('phabricator', 'view/form/control/submit'); phutil_require_module('phabricator', 'view/form/control/text'); -phutil_require_module('phabricator', 'view/form/control/textarea'); phutil_require_module('phabricator', 'view/form/error'); phutil_require_module('phabricator', 'view/layout/panel'); phutil_require_module('phabricator', 'view/layout/sidenav'); diff --git a/src/docs/arcanist_certificates.diviner b/src/docs/arcanist_certificates.diviner index 760843d68e..c04df9f1a1 100644 --- a/src/docs/arcanist_certificates.diviner +++ b/src/docs/arcanist_certificates.diviner @@ -22,5 +22,4 @@ To retrieve the certificate for a Phabricator host: - Login to Phabricator. - Go to Settings > Arcanist Certificate. -Copy the certificate into the "cert" field, and specify your username in the -"user" field. +Copy the host info including the certificate into the "hosts" section. diff --git a/src/view/form/control/textarea/AphrontFormTextAreaControl.php b/src/view/form/control/textarea/AphrontFormTextAreaControl.php index 33a5873c08..072619f401 100755 --- a/src/view/form/control/textarea/AphrontFormTextAreaControl.php +++ b/src/view/form/control/textarea/AphrontFormTextAreaControl.php @@ -50,6 +50,7 @@ class AphrontFormTextAreaControl extends AphrontFormControl { 'name' => $this->getName(), 'disabled' => $this->getDisabled() ? 'disabled' : null, 'class' => $height_class, + 'style' => $this->getControlStyle(), 'id' => $this->getID(), ), phutil_escape_html($this->getValue()));