mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-01-24 08:19:58 +01:00
fixed an sso issue
This commit is contained in:
parent
8237d64583
commit
75c1143a62
@ -265,17 +265,20 @@ class ModelUserAuth extends Model {
|
|||||||
|
|
||||||
$role = 0;
|
$role = 0;
|
||||||
|
|
||||||
if(!isset($_SERVER['REMOTE_USER'])) { return 0; }
|
if(!isset($_SERVER['REMOTE_USER']) || $_SERVER['REMOTE_USER'] == '') { return 0; }
|
||||||
|
|
||||||
$u = explode("\\", $_SERVER['REMOTE_USER']);
|
$u = explode("\\", $_SERVER['REMOTE_USER']);
|
||||||
|
|
||||||
if(!isset($u[1])) { return 0; }
|
if(isset($u[1])) { $username = $u[1]; }
|
||||||
|
else { $username = $_SERVER['REMOTE_USER']; }
|
||||||
|
|
||||||
|
if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, "sso login: $username"); }
|
||||||
|
|
||||||
$ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD);
|
$ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD);
|
||||||
|
|
||||||
if($ldap->is_bind_ok()) {
|
if($ldap->is_bind_ok()) {
|
||||||
|
|
||||||
$query = $ldap->query(LDAP_BASE_DN, "(&(objectClass=$ldap_account_objectclass)(samaccountname=" . $u[1] . "))", array());
|
$query = $ldap->query(LDAP_BASE_DN, "(&(objectClass=$ldap_account_objectclass)(samaccountname=" . $username . "))", array());
|
||||||
|
|
||||||
if(isset($query->row['dn'])) {
|
if(isset($query->row['dn'])) {
|
||||||
$a = $query->row;
|
$a = $query->row;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user