Differential D19516 Diff 46674 src/applications/conduit/controller/PhabricatorConduitAPIController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/controller/PhabricatorConduitAPIController.php
Show First 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | if ($auth_type === ConduitClient::AUTH_ASYMMETRIC) { | ||||
// associated with this public key. | // associated with this public key. | ||||
$stored_key = id(new PhabricatorAuthSSHKeyQuery()) | $stored_key = id(new PhabricatorAuthSSHKeyQuery()) | ||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer(PhabricatorUser::getOmnipotentUser()) | ||||
->withKeys(array($public_key)) | ->withKeys(array($public_key)) | ||||
->withIsActive(true) | ->withIsActive(true) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$stored_key) { | if (!$stored_key) { | ||||
$key_summary = id(new PhutilUTF8StringTruncator()) | |||||
->setMaximumBytes(64) | |||||
->truncateString($raw_key); | |||||
return array( | return array( | ||||
'ERR-INVALID-AUTH', | 'ERR-INVALID-AUTH', | ||||
pht('No user or device is associated with that public key.'), | pht( | ||||
'No user or device is associated with the public key "%s".', | |||||
$key_summary), | |||||
); | ); | ||||
} | } | ||||
$object = $stored_key->getObject(); | $object = $stored_key->getObject(); | ||||
if ($object instanceof PhabricatorUser) { | if ($object instanceof PhabricatorUser) { | ||||
$user = $object; | $user = $object; | ||||
} else { | } else { | ||||
▲ Show 20 Lines • Show All 487 Lines • Show Last 20 Lines |