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); 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'] = ''; +?>