summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-08-27 16:28:51 +0200
committerRobin Appelman <icewind@owncloud.com>2014-08-31 10:47:50 +0200
commit4efe6f62402482608cb1b2f4c51b9b3e41603733 (patch)
tree371c210240a69df23e0a732d8f45dd0993fa5bb9 /settings
parent1361bbb1e6a47266cf3a11b2ddba77706522d9e0 (diff)
downloadnextcloud-server-4efe6f62402482608cb1b2f4c51b9b3e41603733.tar.gz
nextcloud-server-4efe6f62402482608cb1b2f4c51b9b3e41603733.zip
Add unit tests and fix rootcerts creation bug
Diffstat (limited to 'settings')
-rw-r--r--settings/ajax/addRootCertificate.php7
-rw-r--r--settings/js/personal.js2
-rw-r--r--settings/templates/personal.php9
3 files changed, 11 insertions, 7 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'));
}
diff --git a/settings/js/personal.js b/settings/js/personal.js
index d6546717d16..11e9593d74a 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -325,7 +325,7 @@ $(document).ready(function () {
var row = $('<tr/>');
row.addClass(isExpired? 'expired': 'valid');
row.append($('<td/>').attr('title', data.result.organization).text(data.result.commonName));
- row.append($('<td/>').attr('title', t('core,', 'Valid from {date}', {date: data.result.validFromString}))
+ row.append($('<td/>').attr('title', t('core,', 'Valid until {date}', {date: data.result.validFromString}))
.text(data.result.validTillString));
row.append($('<td/>').attr('title', data.result.issuerOrganization).text(data.result.issuer));
row.append($('<td/>').addClass('remove').append(
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 8cb7be27735..871a0ec9e39 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -2,7 +2,10 @@
* Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
- */?>
+ */
+
+/** @var $_ array */
+?>
<div class="clientsbox center">
<h2><?php p($l->t('Get the apps to sync your files'));?></h2>
@@ -160,12 +163,12 @@ if($_['passwordChangeSupported']) {
<th/>
</thead>
<tbody>
- <?php foreach ($_['certs'] as $rootCert): /**@var \OCP\ICertificate $rootCert*/?>
+ <?php foreach ($_['certs'] as $rootCert): /**@var \OCP\ICertificate $rootCert*/ ?>
<tr class="<?php echo ($rootCert->isExpired()) ? 'expired' : 'valid' ?>" data-name="<?php p($rootCert->getName()) ?>">
<td class="rootCert" title="<?php p($rootCert->getOrganization())?>">
<?php p($rootCert->getCommonName()) ?>
</td>
- <td title="<?php p($l->t('Valid from %s', $l->l('date', $rootCert->getExpireDate()))) ?>">
+ <td title="<?php p($l->t('Valid until %s', $l->l('date', $rootCert->getExpireDate()))) ?>">
<?php echo $l->l('date', $rootCert->getExpireDate()) ?>
</td>
<td title="<?php p($rootCert->getIssuerOrganization()) ?>">