Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php
<?php | <?php | ||||
final class PhabricatorAuthSSHKeyEditor | final class PhabricatorAuthSSHKeyEditor | ||||
extends PhabricatorApplicationTransactionEditor { | extends PhabricatorApplicationTransactionEditor { | ||||
private $isAdministrativeEdit; | |||||
public function setIsAdministrativeEdit($is_administrative_edit) { | |||||
$this->isAdministrativeEdit = $is_administrative_edit; | |||||
return $this; | |||||
} | |||||
public function getIsAdministrativeEdit() { | |||||
return $this->isAdministrativeEdit; | |||||
} | |||||
public function getEditorApplicationClass() { | public function getEditorApplicationClass() { | ||||
return 'PhabricatorAuthApplication'; | return 'PhabricatorAuthApplication'; | ||||
} | } | ||||
public function getEditorObjectsDescription() { | public function getEditorObjectsDescription() { | ||||
return pht('SSH Keys'); | return pht('SSH Keys'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | final class PhabricatorAuthSSHKeyEditor | ||||
} | } | ||||
protected function buildMailBody( | protected function buildMailBody( | ||||
PhabricatorLiskDAO $object, | PhabricatorLiskDAO $object, | ||||
array $xactions) { | array $xactions) { | ||||
$body = parent::buildMailBody($object, $xactions); | $body = parent::buildMailBody($object, $xactions); | ||||
if (!$this->getIsAdministrativeEdit()) { | |||||
$body->addTextSection( | $body->addTextSection( | ||||
pht('SECURITY WARNING'), | pht('SECURITY WARNING'), | ||||
pht( | pht( | ||||
'If you do not recognize this change, it may indicate your account '. | 'If you do not recognize this change, it may indicate your account '. | ||||
'has been compromised.')); | 'has been compromised.')); | ||||
} | |||||
$detail_uri = $object->getURI(); | $detail_uri = $object->getURI(); | ||||
$detail_uri = PhabricatorEnv::getProductionURI($detail_uri); | $detail_uri = PhabricatorEnv::getProductionURI($detail_uri); | ||||
$body->addLinkSection(pht('SSH KEY DETAIL'), $detail_uri); | $body->addLinkSection(pht('SSH KEY DETAIL'), $detail_uri); | ||||
return $body; | return $body; | ||||
} | } | ||||
protected function getCustomWorkerState() { | |||||
return array( | |||||
'isAdministrativeEdit' => $this->isAdministrativeEdit, | |||||
); | |||||
} | |||||
protected function loadCustomWorkerState(array $state) { | |||||
$this->isAdministrativeEdit = idx($state, 'isAdministrativeEdit'); | |||||
return $this; | |||||
} | |||||
} | } |