Page MenuHomePhabricator

D9299.diff
No OneTemporary

D9299.diff

diff --git a/src/applications/passphrase/controller/PassphraseCredentialEditController.php b/src/applications/passphrase/controller/PassphraseCredentialEditController.php
--- a/src/applications/passphrase/controller/PassphraseCredentialEditController.php
+++ b/src/applications/passphrase/controller/PassphraseCredentialEditController.php
@@ -26,23 +26,18 @@
return new Aphront404Response();
}
- $type = PassphraseCredentialType::getTypeByConstant(
- $credential->getCredentialType());
- if (!$type) {
- throw new Exception(pht('Credential has invalid type "%s"!', $type));
- }
-
- if (!$type->isCreateable()) {
- throw new Exception(
- pht('Credential has noncreateable type "%s"!', $type));
- }
+ $type = $this->getCredentialType($credential->getCredentialType());
$is_new = false;
} else {
$type_const = $request->getStr('type');
- $type = PassphraseCredentialType::getTypeByConstant($type_const);
- if (!$type) {
- return new Aphront404Response();
+ $type = $this->getCredentialType($type_const);
+
+ if (!$type->isCreateable()) {
+ throw new Exception(
+ pht(
+ 'Credential has noncreateable type "%s"!',
+ $credential->getCredentialType()));
}
$credential = PassphraseCredential::initializeNewCredential($viewer)
@@ -358,4 +353,15 @@
));
}
+ private function getCredentialType($type_const) {
+ $type = PassphraseCredentialType::getTypeByConstant($type_const);
+
+ if (!$type) {
+ throw new Exception(
+ pht('Credential has invalid type "%s"!', $type_const));
+ }
+
+ return $type;
+ }
+
}

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 4:00 AM (17 h, 25 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6920532
Default Alt Text
D9299.diff (1 KB)

Event Timeline