summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-08-21 22:22:35 +0200
committerMorris Jobke <hey@morrisjobke.de>2014-08-25 22:15:54 +0200
commit0a2e4711631c404f55a8c41f8609e6b403c7e408 (patch)
tree8fa324537d8311dab2339a31bb390e859ed33ee4 /settings
parenta70fe184e7cf13d7da33fdaf2b606abbaa8a2d33 (diff)
downloadnextcloud-server-0a2e4711631c404f55a8c41f8609e6b403c7e408.tar.gz
nextcloud-server-0a2e4711631c404f55a8c41f8609e6b403c7e408.zip
Add a trusted domain wizard
Adds a little button to the trusted domain warning, if an admin clicks on the warning he will be redirected to ownCloud and asked whether he want to trust this domain. By far not the cleanest code, or clean at all, but does the job and I don't see a reason to make a lot of changes for this little improvement.
Diffstat (limited to 'settings')
-rw-r--r--settings/ajax/setsecurity.php12
-rw-r--r--settings/js/admin.js16
2 files changed, 26 insertions, 2 deletions
diff --git a/settings/ajax/setsecurity.php b/settings/ajax/setsecurity.php
index 675d7eced47..3cb1d05ee63 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_Config::setValue( 'forcessl', filter_var($_POST['enforceHTTPS'], FILTER_VALIDATE_BOOLEAN));
+}
+
+if(isset($_POST['trustedDomain'])) {
+ $trustedDomains = OC_Config::getValue('trusted_domains');
+ $trustedDomains[] = $_POST['trustedDomain'];
+ OC_Config::setValue('trusted_domains', $trustedDomains);
+}
echo 'true';
diff --git a/settings/js/admin.js b/settings/js/admin.js
index a202feb4f65..b09704f87b7 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -38,6 +38,22 @@ 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}
+ });
+ }
+ });
+ }
+
$('select#excludedGroups[multiple]').each(function (index, element) {
SharingGroupList.applyMultipleSelect($(element));