sso fixes

This commit is contained in:
SJ 2013-10-17 23:22:03 +02:00
parent 40a04bc143
commit 3ef900b68f
3 changed files with 11 additions and 9 deletions

View File

@ -12,6 +12,7 @@ class ControllerLoginSSO extends Controller {
$request = Registry::get('request'); $request = Registry::get('request');
$session = Registry::get('session');
$db = Registry::get('db'); $db = Registry::get('db');

View File

@ -329,6 +329,11 @@ class ModelUserAuth extends Model {
if(isset($a['mail']['count'])) { $username = $a['mail'][0]; } else { $username = $a['mail']; } if(isset($a['mail']['count'])) { $username = $a['mail'][0]; } else { $username = $a['mail']; }
$username = strtolower(preg_replace("/^smtp\:/i", "", $username)); $username = strtolower(preg_replace("/^smtp\:/i", "", $username));
if($username == '') {
syslog(LOG_INFO, "no email address found for " . $a['dn']);
return 0;
}
$query = $ldap->query(LDAP_BASE_DN, "(|(&(objectClass=$ldap_account_objectclass)($ldap_mail_attr=$username))(&(objectClass=$ldap_distributionlist_objectclass)($ldap_distributionlist_attr=$username)" . ")(&(objectClass=$ldap_distributionlist_objectclass)($ldap_distributionlist_attr=" . $a['dn'] . ")))", array()); $query = $ldap->query(LDAP_BASE_DN, "(|(&(objectClass=$ldap_account_objectclass)($ldap_mail_attr=$username))(&(objectClass=$ldap_distributionlist_objectclass)($ldap_distributionlist_attr=$username)" . ")(&(objectClass=$ldap_distributionlist_objectclass)($ldap_distributionlist_attr=" . $a['dn'] . ")))", array());
$emails = $this->get_email_array_from_ldap_attr($query->rows); $emails = $this->get_email_array_from_ldap_attr($query->rows);

View File

@ -1,25 +1,19 @@
<?php <?php
function go_to_setup() { session_start();
Header("Location: setup/setup.php");
exit;
}
$stat = stat("config.php") or go_to_setup();
if($stat[7] < 15){ go_to_setup(); }
require_once("config.php"); require_once("config.php");
require(DIR_SYSTEM . "/startup.php"); require(DIR_SYSTEM . "/startup.php");
$session = new Session();
Registry::set("session", $session);
$request = new Request(); $request = new Request();
Registry::set("request", $request); Registry::set("request", $request);
session_start();
Registry::set('document', new Document()); Registry::set('document', new Document());
@ -30,6 +24,8 @@ Registry::set('load', $loader);
$language = new Language(); $language = new Language();
Registry::set('language', $language); Registry::set('language', $language);
if(ENABLE_SYSLOG == 1) { openlog("piler-webui", LOG_PID, LOG_MAIL); }
$db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PREFIX); $db = new DB(DB_DRIVER, DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE, DB_PREFIX);
Registry::set('DB_DATABASE', DB_DATABASE); Registry::set('DB_DATABASE', DB_DATABASE);