Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorSettingsPanelConduit.php
<?php | <?php | ||||
final class PhabricatorSettingsPanelConduit | final class PhabricatorSettingsPanelConduit | ||||
extends PhabricatorSettingsPanel { | extends PhabricatorSettingsPanel { | ||||
public function isEditableByAdministrators() { | |||||
return true; | |||||
} | |||||
public function getPanelKey() { | public function getPanelKey() { | ||||
return 'conduit'; | return 'conduit'; | ||||
} | } | ||||
public function getPanelName() { | public function getPanelName() { | ||||
return pht('Conduit'); | return pht('Conduit Certificate'); | ||||
} | } | ||||
public function getPanelGroup() { | public function getPanelGroup() { | ||||
return pht('Authentication'); | return pht('Authentication'); | ||||
} | } | ||||
public function processRequest(AphrontRequest $request) { | public function processRequest(AphrontRequest $request) { | ||||
$user = $request->getUser(); | $user = $this->getUser(); | ||||
$viewer = $request->getUser(); | |||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
if (!$request->isDialogFormPost()) { | if (!$request->isDialogFormPost()) { | ||||
$dialog = new AphrontDialogView(); | $dialog = new AphrontDialogView(); | ||||
$dialog->setUser($user); | $dialog->setUser($viewer); | ||||
$dialog->setTitle(pht('Really regenerate session?')); | $dialog->setTitle(pht('Really regenerate session?')); | ||||
$dialog->setSubmitURI($this->getPanelURI()); | $dialog->setSubmitURI($this->getPanelURI()); | ||||
$dialog->addSubmitButton(pht('Regenerate')); | $dialog->addSubmitButton(pht('Regenerate')); | ||||
$dialog->addCancelbutton($this->getPanelURI()); | $dialog->addCancelbutton($this->getPanelURI()); | ||||
$dialog->appendChild(phutil_tag('p', array(), pht( | $dialog->appendChild(phutil_tag('p', array(), pht( | ||||
'Really destroy the old certificate? Any established '. | 'Really destroy the old certificate? Any established '. | ||||
'sessions will be terminated.'))); | 'sessions will be terminated.'))); | ||||
Show All 31 Lines | public function processRequest(AphrontRequest $request) { | ||||
} else { | } else { | ||||
$notice = null; | $notice = null; | ||||
} | } | ||||
Javelin::initBehavior('select-on-click'); | Javelin::initBehavior('select-on-click'); | ||||
$cert_form = new AphrontFormView(); | $cert_form = new AphrontFormView(); | ||||
$cert_form | $cert_form | ||||
->setUser($user) | ->setUser($viewer) | ||||
->appendChild(phutil_tag( | ->appendChild(phutil_tag( | ||||
'p', | 'p', | ||||
array('class' => 'aphront-form-instructions'), | array('class' => 'aphront-form-instructions'), | ||||
pht('This certificate allows you to authenticate over Conduit, '. | pht('This certificate allows you to authenticate over Conduit, '. | ||||
'the Phabricator API. Normally, you just run %s to install it.', | 'the Phabricator API. Normally, you just run %s to install it.', | ||||
phutil_tag('tt', array(), 'arc install-certificate')))) | phutil_tag('tt', array(), 'arc install-certificate')))) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormTextAreaControl()) | id(new AphrontFormTextAreaControl()) | ||||
->setLabel(pht('Certificate')) | ->setLabel(pht('Certificate')) | ||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_SHORT) | ->setHeight(AphrontFormTextAreaControl::HEIGHT_SHORT) | ||||
->setReadonly(true) | ->setReadonly(true) | ||||
->setSigil('select-on-click') | ->setSigil('select-on-click') | ||||
->setValue($user->getConduitCertificate())); | ->setValue($user->getConduitCertificate())); | ||||
$cert_form = id(new PHUIObjectBoxView()) | $cert_form = id(new PHUIObjectBoxView()) | ||||
->setHeaderText(pht('Arcanist Certificate')) | ->setHeaderText(pht('Arcanist Certificate')) | ||||
->setForm($cert_form); | ->setForm($cert_form); | ||||
$regen_instruction = pht('You can regenerate this certificate, which '. | $regen_instruction = pht('You can regenerate this certificate, which '. | ||||
'will invalidate the old certificate and create a new one.'); | 'will invalidate the old certificate and create a new one.'); | ||||
$regen_form = new AphrontFormView(); | $regen_form = new AphrontFormView(); | ||||
$regen_form | $regen_form | ||||
->setUser($user) | ->setUser($viewer) | ||||
->setAction($this->getPanelURI()) | ->setAction($this->getPanelURI()) | ||||
->setWorkflow(true) | ->setWorkflow(true) | ||||
->appendChild(phutil_tag( | ->appendChild(phutil_tag( | ||||
'p', | 'p', | ||||
array('class' => 'aphront-form-instructions'), | array('class' => 'aphront-form-instructions'), | ||||
$regen_instruction)) | $regen_instruction)) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormSubmitControl()) | id(new AphrontFormSubmitControl()) | ||||
Show All 13 Lines |