Remove product literal strings in "pht()", part 18
[phabricator.git] / src / applications / auth / controller / PhabricatorAuthSSHKeyRevokeController.php
blob0547c2175df101c535416a0f78969d5a1f122cfd
1 <?php
3 final class PhabricatorAuthSSHKeyRevokeController
4 extends PhabricatorAuthSSHKeyController {
6 public function handleRequest(AphrontRequest $request) {
7 $viewer = $this->getViewer();
9 $key = id(new PhabricatorAuthSSHKeyQuery())
10 ->setViewer($viewer)
11 ->withIDs(array($request->getURIData('id')))
12 ->requireCapabilities(
13 array(
14 PhabricatorPolicyCapability::CAN_VIEW,
15 PhabricatorPolicyCapability::CAN_EDIT,
17 ->executeOne();
18 if (!$key) {
19 return new Aphront404Response();
22 $cancel_uri = $key->getURI();
24 $token = id(new PhabricatorAuthSessionEngine())->requireHighSecuritySession(
25 $viewer,
26 $request,
27 $cancel_uri);
29 if ($request->isFormPost()) {
30 $xactions = array();
32 $xactions[] = id(new PhabricatorAuthSSHKeyTransaction())
33 ->setTransactionType(PhabricatorAuthSSHKeyTransaction::TYPE_DEACTIVATE)
34 ->setNewValue(true);
36 id(new PhabricatorAuthSSHKeyEditor())
37 ->setActor($viewer)
38 ->setContentSourceFromRequest($request)
39 ->setContinueOnNoEffect(true)
40 ->setContinueOnMissingFields(true)
41 ->applyTransactions($key, $xactions);
43 return id(new AphrontRedirectResponse())->setURI($cancel_uri);
46 $name = phutil_tag('strong', array(), $key->getName());
48 return $this->newDialog()
49 ->setTitle(pht('Revoke SSH Public Key'))
50 ->appendParagraph(
51 pht(
52 'The key "%s" will be permanently revoked, and you will no '.
53 'longer be able to use the corresponding private key to '.
54 'authenticate.',
55 $name))
56 ->addSubmitButton(pht('Revoke Public Key'))
57 ->addCancelButton($cancel_uri);