From 7a7f2b0bd48657fa40b271ffcf32c528409ff6d3 Mon Sep 17 00:00:00 2001 From: tehron Date: Sun, 20 Oct 2019 19:58:39 +0200 Subject: [PATCH 1/2] add missing config variables for LDAP --- files/example.config.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/files/example.config.php b/files/example.config.php index 1f853c0..ff17503 100644 --- a/files/example.config.php +++ b/files/example.config.php @@ -32,4 +32,10 @@ $config['socket']['key'] = ''; $config['ssga-ua'] = ''; -?> \ No newline at end of file + + $config['ldap']['enabled'] = false; + $config['ldap']['host'] = ''; + $config['ldap']['username'] = ''; + $config['ldap']['password'] = ''; + $config['ldap']['dn'] = ''; +?> From 9e6f605b4acc4213ddbc56ea39dd63572a6f705e Mon Sep 17 00:00:00 2001 From: tehron Date: Sun, 20 Oct 2019 19:58:51 +0200 Subject: [PATCH 2/2] allow to disable LDAP --- files/class.ldap.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/files/class.ldap.php b/files/class.ldap.php index 9f8d741..932ebb5 100644 --- a/files/class.ldap.php +++ b/files/class.ldap.php @@ -10,6 +10,10 @@ public function __construct($app) { $this->config = $config = $this->app->config['ldap']; } + public function isEnabled() { + return $this->config['enabled']; + } + private function bind($authenticated=false) { if ($this->connected) { if ($authenticated && !$this->authenticated) { @@ -44,6 +48,7 @@ private function bind($authenticated=false) { } public function checkLogin($username, $password) { + if (!$this->isEnabled()) return false; if (!$username || !$password) return false; $username = $this->escapeUsername($username); @@ -73,6 +78,7 @@ public function checkLogin($username, $password) { } public function createUser($user_id, $username, $password) { + if (!$this->isEnabled()) return false; $username = $this->escapeUsername($username); if (!$username) return false; @@ -96,6 +102,7 @@ public function createUser($user_id, $username, $password) { } public function changePassword($username, $newPassword) { + if (!$this->isEnabled()) return false; if (!$username || !$newPassword) return false; $username = $this->escapeUsername($username);