diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-08-27 16:28:51 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-08-31 10:47:50 +0200 |
commit | 4efe6f62402482608cb1b2f4c51b9b3e41603733 (patch) | |
tree | 371c210240a69df23e0a732d8f45dd0993fa5bb9 /settings/ajax | |
parent | 1361bbb1e6a47266cf3a11b2ddba77706522d9e0 (diff) | |
download | nextcloud-server-4efe6f62402482608cb1b2f4c51b9b3e41603733.tar.gz nextcloud-server-4efe6f62402482608cb1b2f4c51b9b3e41603733.zip |
Add unit tests and fix rootcerts creation bug
Diffstat (limited to 'settings/ajax')
-rw-r--r-- | settings/ajax/addRootCertificate.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/settings/ajax/addRootCertificate.php b/settings/ajax/addRootCertificate.php index 87b1460ef12..378ef39c1e5 100644 --- a/settings/ajax/addRootCertificate.php +++ b/settings/ajax/addRootCertificate.php @@ -1,4 +1,5 @@ <?php +OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); $l = new OC_L10N('core'); @@ -13,8 +14,8 @@ $filename = basename($_FILES['rootcert_import']['name']); $certificateManager = \OC::$server->getCertificateManager(); -$cert = $certificateManager->addCertificate($data, $filename); -if ($cert) { +try { + $cert = $certificateManager->addCertificate($data, $filename); OCP\JSON::success(array( 'name' => $cert->getName(), 'commonName' => $cert->getCommonName(), @@ -26,6 +27,6 @@ if ($cert) { 'issuer' => $cert->getIssuerName(), 'issuerOrganization' => $cert->getIssuerOrganization() )); -} else { +} catch(\Exception $e) { OCP\JSON::error(array('error' => 'Couldn\'t import SSL root certificate, allowed formats: PEM and DER')); } |