summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-08-28 15:06:27 +0200
committerGitHub <noreply@github.com>2016-08-28 15:06:27 +0200
commit3647fbe7cd86e743b059889d69b03fcf8207780f (patch)
treeb6241abe21758515ef143e34bb9adab6a418c019 /apps
parent25f1fdb2759effa6c75a3c25663234af3b9be68f (diff)
parent5b4e7520794f9ac080c07c13ca6241313545f1b9 (diff)
downloadnextcloud-server-3647fbe7cd86e743b059889d69b03fcf8207780f.tar.gz
nextcloud-server-3647fbe7cd86e743b059889d69b03fcf8207780f.zip
Merge pull request #976 from nextcloud/downstream-25702
Hide the LDAP password in the client side
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/ajax/getConfiguration.php7
-rw-r--r--apps/user_ldap/ajax/testConfiguration.php16
-rw-r--r--apps/user_ldap/js/wizard/configModel.js2
-rw-r--r--apps/user_ldap/js/wizard/view.js2
4 files changed, 19 insertions, 8 deletions
diff --git a/apps/user_ldap/ajax/getConfiguration.php b/apps/user_ldap/ajax/getConfiguration.php
index 0537349bbeb..34ac97f29e7 100644
--- a/apps/user_ldap/ajax/getConfiguration.php
+++ b/apps/user_ldap/ajax/getConfiguration.php
@@ -32,4 +32,9 @@ OCP\JSON::callCheck();
$prefix = (string)$_POST['ldap_serverconfig_chooser'];
$ldapWrapper = new OCA\User_LDAP\LDAP();
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
-OCP\JSON::success(array('configuration' => $connection->getConfiguration()));
+$configuration = $connection->getConfiguration();
+if (isset($configuration['ldap_agent_password']) && $configuration['ldap_agent_password'] !== '') {
+ // hide password
+ $configuration['ldap_agent_password'] = '**PASSWORD SET**';
+}
+OCP\JSON::success(array('configuration' => $configuration));
diff --git a/apps/user_ldap/ajax/testConfiguration.php b/apps/user_ldap/ajax/testConfiguration.php
index f73e11d3e21..0416e49767b 100644
--- a/apps/user_ldap/ajax/testConfiguration.php
+++ b/apps/user_ldap/ajax/testConfiguration.php
@@ -33,12 +33,19 @@ OCP\JSON::callCheck();
$l = \OC::$server->getL10N('user_ldap');
$ldapWrapper = new OCA\User_LDAP\LDAP();
-$connection = new \OCA\User_LDAP\Connection($ldapWrapper, '', null);
-//needs to be true, otherwise it will also fail with an irritating message
-$_POST['ldap_configuration_active'] = 1;
+$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $_POST['ldap_serverconfig_chooser']);
+
try {
- if ($connection->setConfiguration($_POST)) {
+ $configurationOk = true;
+ $conf = $connection->getConfiguration();
+ if ($conf['ldap_configuration_active'] === '0') {
+ //needs to be true, otherwise it will also fail with an irritating message
+ $conf['ldap_configuration_active'] = '1';
+ $configurationOk = $connection->setConfiguration($conf);
+ }
+ if ($configurationOk) {
+ //Configuration is okay
/*
* Clossing the session since it won't be used from this point on. There might be a potential
* race condition if a second request is made: either this request or the other might not
@@ -46,7 +53,6 @@ try {
* problem with that other than the extra connection.
*/
\OC::$server->getSession()->close();
- //Configuration is okay
if ($connection->bind()) {
/*
* This shiny if block is an ugly hack to find out whether anonymous
diff --git a/apps/user_ldap/js/wizard/configModel.js b/apps/user_ldap/js/wizard/configModel.js
index c3f1e85b592..3732409c3e1 100644
--- a/apps/user_ldap/js/wizard/configModel.js
+++ b/apps/user_ldap/js/wizard/configModel.js
@@ -318,7 +318,7 @@ OCA = OCA || {};
*/
requestConfigurationTest: function() {
var url = OC.generateUrl('apps/user_ldap/ajax/testConfiguration.php');
- var params = OC.buildQueryString(this.configuration);
+ var params = OC.buildQueryString({ldap_serverconfig_chooser: this.configID});
var model = this;
$.post(url, params, function(result) { model._processTestResult(model, result) });
//TODO: make sure only one test is running at a time
diff --git a/apps/user_ldap/js/wizard/view.js b/apps/user_ldap/js/wizard/view.js
index 9c7e2132dc6..1a89eba3515 100644
--- a/apps/user_ldap/js/wizard/view.js
+++ b/apps/user_ldap/js/wizard/view.js
@@ -271,7 +271,7 @@ OCA = OCA || {};
* requests a configuration test
*/
onTestButtonClick: function() {
- this.configModel.requestWizard('ldap_action_test_connection', this.configModel.configuration);
+ this.configModel.requestWizard('ldap_action_test_connection', {ldap_serverconfig_chooser: this.configModel.configID});
},
/**