summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-08-22 17:12:17 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-08-22 17:12:17 +0200
commita77d468d3568055ee85dd9508a2f009cb5da650f (patch)
treebf76ca296b9589693f9ac522cca1eff94f4eb60f /settings
parent620610a3a7ac57fc43dc232bca9b74ac709f1ca5 (diff)
parentdd871098c5f598326a1bc03f8b7bed0d2184e798 (diff)
downloadnextcloud-server-a77d468d3568055ee85dd9508a2f009cb5da650f.tar.gz
nextcloud-server-a77d468d3568055ee85dd9508a2f009cb5da650f.zip
Merge pull request #10584 from owncloud/simple-wizard-trusted-domains
Add a trusted domain wizard
Diffstat (limited to 'settings')
-rw-r--r--settings/ajax/setsecurity.php12
-rw-r--r--settings/js/admin.js18
2 files changed, 28 insertions, 2 deletions
diff --git a/settings/ajax/setsecurity.php b/settings/ajax/setsecurity.php
index 675d7eced47..f1f737a4943 100644
--- a/settings/ajax/setsecurity.php
+++ b/settings/ajax/setsecurity.php
@@ -1,6 +1,6 @@
<?php
/**
- * Copyright (c) 2013, Lukas Reschke <lukas@statuscode.ch>
+ * Copyright (c) 2013-2014, Lukas Reschke <lukas@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
@@ -8,6 +8,14 @@
OC_Util::checkAdminUser();
OCP\JSON::callCheck();
-OC_Config::setValue( 'forcessl', filter_var($_POST['enforceHTTPS'], FILTER_VALIDATE_BOOLEAN));
+if(isset($_POST['enforceHTTPS'])) {
+ \OC::$server->getConfig()->setSystemValue('forcessl', filter_var($_POST['enforceHTTPS'], FILTER_VALIDATE_BOOLEAN));
+}
+
+if(isset($_POST['trustedDomain'])) {
+ $trustedDomains = \OC::$server->getConfig()->getSystemValue('trusted_domains');
+ $trustedDomains[] = $_POST['trustedDomain'];
+ \OC::$server->getConfig()->setSystemValue('trusted_domains', $trustedDomains);
+}
echo 'true';
diff --git a/settings/js/admin.js b/settings/js/admin.js
index a202feb4f65..56dc1b98716 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -38,6 +38,24 @@ var SharingGroupList = {
};
$(document).ready(function(){
+ var params = OC.Util.History.parseUrlQuery();
+
+ // Hack to add a trusted domain
+ if (params.trustDomain) {
+ OC.dialogs.confirm(t('core', 'Are you really sure you want add "{domain}" as trusted domain?', {domain: params.trustDomain}),
+ t('core', 'Add trusted domain'), function(answer) {
+ if(answer) {
+ $.ajax({
+ type: 'POST',
+ url: OC.generateUrl('settings/ajax/setsecurity.php'),
+ data: { trustedDomain: params.trustDomain }
+ }).done(function() {
+ window.location.replace(OC.generateUrl('settings/admin'));
+ });
+ }
+ });
+ }
+
$('select#excludedGroups[multiple]').each(function (index, element) {
SharingGroupList.applyMultipleSelect($(element));