Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Ldap fixes #245

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions files/class.ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion files/example.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,10 @@
$config['socket']['key'] = '';

$config['ssga-ua'] = '';
?>

$config['ldap']['enabled'] = false;
$config['ldap']['host'] = '';
$config['ldap']['username'] = '';
$config['ldap']['password'] = '';
$config['ldap']['dn'] = '';
?>