Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14395288
D9299.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9299.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D9299: Fix two Passphrase credential type issues
Attached
Detach File
Event Timeline
Log In to Comment