Differential D10414 Diff 25065 src/applications/passphrase/controller/PassphraseCredentialRevealController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/passphrase/controller/PassphraseCredentialRevealController.php
Show All 40 Lines | if ($is_locked) { | ||||
->setTitle(pht('Credential is locked')) | ->setTitle(pht('Credential is locked')) | ||||
->appendChild( | ->appendChild( | ||||
pht( | pht( | ||||
'This credential can not be shown, because it is locked.')) | 'This credential can not be shown, because it is locked.')) | ||||
->addCancelButton($view_uri); | ->addCancelButton($view_uri); | ||||
} | } | ||||
if ($request->isFormPost()) { | if ($request->isFormPost()) { | ||||
if ($credential->getSecret()) { | $secret = $credential->getSecret(); | ||||
if (!$secret) { | |||||
$body = pht('This credential has no associated secret.'); | |||||
} else if (!strlen($secret->openEnvelope())) { | |||||
$body = pht('This credential has an empty secret.'); | |||||
} else { | |||||
$body = id(new PHUIFormLayoutView()) | $body = id(new PHUIFormLayoutView()) | ||||
->appendChild( | ->appendChild( | ||||
id(new AphrontFormTextAreaControl()) | id(new AphrontFormTextAreaControl()) | ||||
->setLabel(pht('Plaintext')) | ->setLabel(pht('Plaintext')) | ||||
->setReadOnly(true) | ->setReadOnly(true) | ||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) | ->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL) | ||||
->setValue($credential->getSecret()->openEnvelope())); | ->setValue($secret->openEnvelope())); | ||||
} else { | |||||
$body = pht('This credential has no associated secret.'); | |||||
} | } | ||||
// NOTE: Disable workflow on the cancel button to reload the page so | // NOTE: Disable workflow on the cancel button to reload the page so | ||||
// the viewer can see that their view was logged. | // the viewer can see that their view was logged. | ||||
$dialog = id(new AphrontDialogView()) | $dialog = id(new AphrontDialogView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setWidth(AphrontDialogView::WIDTH_FORM) | ->setWidth(AphrontDialogView::WIDTH_FORM) | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |