mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Fix LDAP logins
This commit is contained in:
parent
039f5da0e1
commit
bbeb51461f
|
@ -63,6 +63,8 @@ class LdapAd extends LdapAdConfiguration
|
||||||
|
|
||||||
parent::init();
|
parent::init();
|
||||||
if($this->isLdapEnabled()) {
|
if($this->isLdapEnabled()) {
|
||||||
|
$this->ldapConfig['account_prefix'] = 'uid=';
|
||||||
|
$this->ldapConfig['account_suffix'] = ','.$this->ldapConfig['base_dn'];
|
||||||
$this->ldap = new Adldap();
|
$this->ldap = new Adldap();
|
||||||
$this->ldap->addProvider($this->ldapConfig);
|
$this->ldap->addProvider($this->ldapConfig);
|
||||||
return true;
|
return true;
|
||||||
|
@ -90,10 +92,7 @@ class LdapAd extends LdapAdConfiguration
|
||||||
$username .= '@' . $this->ldapSettings['ad_domain'];
|
$username .= '@' . $this->ldapSettings['ad_domain'];
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if ($this->ldap->auth()->attempt($username, $password, true) === false) {
|
||||||
$this->ldap->auth()->attempt($username, $password);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
Log::error($e->getMessage());
|
|
||||||
throw new Exception('Unable to validate user credentials!');
|
throw new Exception('Unable to validate user credentials!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue