From 18f0371b71fb187ce3ef8ff5cffb1094f6e8e39a Mon Sep 17 00:00:00 2001 From: Aviv Eyal Date: Wed, 4 Nov 2015 06:35:22 +0000 Subject: [PATCH] Remove Certificate page Summary: Closes T9703. This page has become redundant 10 months ago, at D10988. Test Plan: Look at /settings page, don't see word "Certificate". Reviewers: epriestley, #blessed_reviewers, chad Reviewed By: #blessed_reviewers, chad Subscribers: Korvin Maniphest Tasks: T9703 Differential Revision: https://secure.phabricator.com/D14400 --- src/__phutil_library_map__.php | 2 - ...ricatorConduitCertificateSettingsPanel.php | 138 ------------------ 2 files changed, 140 deletions(-) delete mode 100644 src/applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index d5c4451720..9a7c845810 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1846,7 +1846,6 @@ phutil_register_library_map(array( 'PhabricatorCommonPasswords' => 'applications/auth/constants/PhabricatorCommonPasswords.php', 'PhabricatorConduitAPIController' => 'applications/conduit/controller/PhabricatorConduitAPIController.php', 'PhabricatorConduitApplication' => 'applications/conduit/application/PhabricatorConduitApplication.php', - 'PhabricatorConduitCertificateSettingsPanel' => 'applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php', 'PhabricatorConduitCertificateToken' => 'applications/conduit/storage/PhabricatorConduitCertificateToken.php', 'PhabricatorConduitConnectionLog' => 'applications/conduit/storage/PhabricatorConduitConnectionLog.php', 'PhabricatorConduitConsoleController' => 'applications/conduit/controller/PhabricatorConduitConsoleController.php', @@ -5837,7 +5836,6 @@ phutil_register_library_map(array( 'PhabricatorCommonPasswords' => 'Phobject', 'PhabricatorConduitAPIController' => 'PhabricatorConduitController', 'PhabricatorConduitApplication' => 'PhabricatorApplication', - 'PhabricatorConduitCertificateSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO', 'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO', 'PhabricatorConduitConsoleController' => 'PhabricatorConduitController', diff --git a/src/applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php b/src/applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php deleted file mode 100644 index aca40d5521..0000000000 --- a/src/applications/settings/panel/PhabricatorConduitCertificateSettingsPanel.php +++ /dev/null @@ -1,138 +0,0 @@ -getUser()->getIsMailingList()) { - return false; - } - - return true; - } - - public function processRequest(AphrontRequest $request) { - $user = $this->getUser(); - $viewer = $request->getUser(); - - id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession( - $viewer, - $request, - '/settings/'); - - if ($request->isFormPost()) { - if (!$request->isDialogFormPost()) { - $dialog = new AphrontDialogView(); - $dialog->setUser($viewer); - $dialog->setTitle(pht('Really regenerate session?')); - $dialog->setSubmitURI($this->getPanelURI()); - $dialog->addSubmitButton(pht('Regenerate')); - $dialog->addCancelbutton($this->getPanelURI()); - $dialog->appendChild(phutil_tag('p', array(), pht( - 'Really destroy the old certificate? Any established '. - 'sessions will be terminated.'))); - - return id(new AphrontDialogResponse()) - ->setDialog($dialog); - } - - $sessions = id(new PhabricatorAuthSessionQuery()) - ->setViewer($user) - ->withIdentityPHIDs(array($user->getPHID())) - ->withSessionTypes(array(PhabricatorAuthSession::TYPE_CONDUIT)) - ->execute(); - foreach ($sessions as $session) { - $session->delete(); - } - - // This implicitly regenerates the certificate. - $user->setConduitCertificate(null); - $user->save(); - return id(new AphrontRedirectResponse()) - ->setURI($this->getPanelURI('?regenerated=true')); - } - - if ($request->getStr('regenerated')) { - $notice = new PHUIInfoView(); - $notice->setSeverity(PHUIInfoView::SEVERITY_NOTICE); - $notice->setTitle(pht('Certificate Regenerated')); - $notice->appendChild(phutil_tag( - 'p', - array(), - pht( - 'Your old certificate has been destroyed and you have been issued '. - 'a new certificate. Sessions established under the old certificate '. - 'are no longer valid.'))); - $notice = $notice->render(); - } else { - $notice = null; - } - - Javelin::initBehavior('select-on-click'); - - $cert_form = new AphrontFormView(); - $cert_form - ->setUser($viewer) - ->appendChild(phutil_tag( - 'p', - array('class' => 'aphront-form-instructions'), - pht( - 'This certificate allows you to authenticate over Conduit, '. - 'the Phabricator API. Normally, you just run %s to install it.', - phutil_tag('tt', array(), 'arc install-certificate')))) - ->appendChild( - id(new AphrontFormTextAreaControl()) - ->setLabel(pht('Certificate')) - ->setHeight(AphrontFormTextAreaControl::HEIGHT_SHORT) - ->setReadonly(true) - ->setSigil('select-on-click') - ->setValue($user->getConduitCertificate())); - - $cert_form = id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Arcanist Certificate')) - ->setForm($cert_form); - - $regen_instruction = pht( - 'You can regenerate this certificate, which '. - 'will invalidate the old certificate and create a new one.'); - - $regen_form = new AphrontFormView(); - $regen_form - ->setUser($viewer) - ->setAction($this->getPanelURI()) - ->setWorkflow(true) - ->appendChild(phutil_tag( - 'p', - array('class' => 'aphront-form-instructions'), - $regen_instruction)) - ->appendChild( - id(new AphrontFormSubmitControl()) - ->setValue(pht('Regenerate Certificate'))); - - $regen_form = id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Regenerate Certificate')) - ->setForm($regen_form); - - return array( - $notice, - $cert_form, - $regen_form, - ); - } -}