X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_person.php;h=d0ef8be31322cd50d013f3d3043fe2f90f22ebec;hb=624a8a16f810023c8890b25b9d93a6cc61e478bb;hp=f2a5ad848d288f9cbed210e29fa7753f85f234f0;hpb=9994a4fbf3bee126955dd72d67cf9e11a2164253;p=Pman.Core diff --git a/DataObjects/Core_person.php b/DataObjects/Core_person.php index f2a5ad84..d0ef8be3 100644 --- a/DataObjects/Core_person.php +++ b/DataObjects/Core_person.php @@ -291,16 +291,12 @@ class Pman_Core_DataObjects_Core_person extends DB_DataObject } - // local auth - - $default_admin = false; - if (!empty($ff->Pman['local_autoauth']) && - ($ff->Pman['local_autoauth'] === true) && - ( - empty($_SERVER['PATH_INFO']) || // auto-auth is disabled for home page - $_SERVER['PATH_INFO'] != '/Login' - ) && // auto-auth is disabled for home page - (!empty($_SERVER['SERVER_ADDR'])) && - ( + $auto_auth_allow = false; + if (!empty($ff->Pman['local_autoauth']) && $ff->Pman['local_autoauth'] === true) { + $auto_auth_allow = true; + } + if ( + (!empty($_SERVER['SERVER_ADDR'])) && ( $_SERVER['SERVER_ADDR'] == '127.0.0.1' && $_SERVER['REMOTE_ADDR'] == '127.0.0.1' @@ -311,9 +307,18 @@ class Pman_Core_DataObjects_Core_person extends DB_DataObject $_SERVER['REMOTE_ADDR'] == '::1' ) - ) - ) { - var_dump($_SERVER['PATH_INFO']);exit; + ){ + $auto_auth_allow = true; + } + + + if (empty($_SERVER['PATH_INFO']) || $_SERVER['PATH_INFO'] == '/Login') { + $auto_auth_allow = false; + } + //var_dump($auto_auth_allow); + // local auth - + $default_admin = false; + if ($auto_auth_allow) { $group = DB_DataObject::factory('core_group'); $group->get('name', 'Administrators'); @@ -335,26 +340,13 @@ class Pman_Core_DataObjects_Core_person extends DB_DataObject $u = DB_DataObject::factory($this->tableName()); $ff = HTML_FlexyFramework::get(); - if (!empty($ff->Pman['local_autoauth']) && - ($ff->Pman['local_autoauth'] === true) && - (!empty($_SERVER['SERVER_ADDR'])) && - ( - ( - $_SERVER['SERVER_ADDR'] == '127.0.0.1' && - $_SERVER['REMOTE_ADDR'] == '127.0.0.1' - ) - || - ( - $_SERVER['SERVER_ADDR'] == '::1' && - $_SERVER['REMOTE_ADDR'] == '::1' - ) - ) && + if ($auto_auth_allow && ($default_admin || $u->get('email', $ff->Pman['local_autoauth'])) ) { $user = $default_admin ? $default_admin->toArray() : $u->toArray(); - $_SESSION[get_class($this)][$sesPrefix .'-auth'] = serialize((object) $user); + //$_SESSION[get_class($this)][$sesPrefix .'-auth'] = serialize((object) $user); return true; } @@ -377,10 +369,9 @@ class Pman_Core_DataObjects_Core_person extends DB_DataObject } } if (!$n){ // authenticated as there are no users in the system... - return true; + return true; } - - return false; + return false; }