summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-04-15 14:21:23 +0200
committerLukas Reschke <lukas@owncloud.com>2015-04-20 12:58:58 +0200
commit20a6073a9feb6b0eb4c004e58bb47912c447fef9 (patch)
treedea2c6537e304738fe62245e3cf2cfbe030218f4 /settings/js
parent9f61cf60d49367726bc9b147993dab39eafa0c7b (diff)
downloadnextcloud-server-20a6073a9feb6b0eb4c004e58bb47912c447fef9.tar.gz
nextcloud-server-20a6073a9feb6b0eb4c004e58bb47912c447fef9.zip
Migrate personal certificate handling into AppFramework controllers
Also added unit-tests and better error-handling
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/personal.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js
index 687b02399a7..c251d1572b2 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -297,8 +297,8 @@ $(document).ready(function () {
$('#sslCertificate').on('click', 'td.remove > img', function () {
var row = $(this).parent().parent();
- $.post(OC.generateUrl('settings/ajax/removeRootCertificate'), {
- cert: row.data('name')
+ $.ajax(OC.generateUrl('settings/personal/certificate/{certificate}', {certificate: row.data('name')}), {
+ type: 'DELETE'
});
row.remove();
return true;
@@ -307,18 +307,19 @@ $(document).ready(function () {
$('#sslCertificate tr > td').tipsy({gravity: 'n', live: true});
$('#rootcert_import').fileupload({
- done: function (e, data) {
- var issueDate = new Date(data.result.validFrom * 1000);
- var expireDate = new Date(data.result.validTill * 1000);
+ success: function (data) {
+ var issueDate = new Date(data.validFrom * 1000);
+ var expireDate = new Date(data.validTill * 1000);
var now = new Date();
var isExpired = !(issueDate <= now && now <= expireDate);
var row = $('<tr/>');
+ row.data('name', data.name);
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 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/>').attr('title', data.organization).text(data.commonName));
+ row.append($('<td/>').attr('title', t('core,', 'Valid until {date}', {date: data.validFromString}))
+ .text(data.validTillString));
+ row.append($('<td/>').attr('title', data.issuerOrganization).text(data.issuer));
row.append($('<td/>').addClass('remove').append(
$('<img/>').attr({
alt: t('core', 'Delete'),
@@ -328,6 +329,9 @@ $(document).ready(function () {
));
$('#sslCertificate tbody').append(row);
+ },
+ fail: function (e, data) {
+ OC.Notification.showTemporary(t('settings', 'An error occured. Please upload an ASCII-encoded PEM certificate.'));
}
});