X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=DataObjects%2FCore_person.php;h=85de3f7089a49d445f310ca8954fcfe51050dccb;hb=b36bf5d2f8d0ce1c9d58e0085c233a48bd0bc390;hp=419fc9c0c8f3c29a8143a9b1081fd9a22c83cc0b;hpb=928ccee81f4abe3d3857b2aef55ba341570f1853;p=Pman.Core diff --git a/DataObjects/Core_person.php b/DataObjects/Core_person.php index 419fc9c0..85de3f70 100644 --- a/DataObjects/Core_person.php +++ b/DataObjects/Core_person.php @@ -256,22 +256,25 @@ class Pman_Core_DataObjects_Core_person extends DB_DataObject $sesPrefix = $this->sesPrefix(); + if (self::$authUser) { + return self::$authUser; + } + + if (!empty($_SESSION[get_class($this)][$sesPrefix .'-auth'])) { // in session... $a = unserialize($_SESSION[get_class($this)][$sesPrefix .'-auth']); - $u = DB_DataObject::factory($this->tableName()); if ($a->id && $u->get($a->id)) { //&& strlen($u->passwd)) { - - return $u->verifyAuth(); // got authentication... - - + if ($u->verifyAuth()) { + self::$authUser = $u; + return true; + } } - unset($_SESSION[get_class($this)][$sesPrefix .'-auth']); unset($_SESSION[get_class($this)][$sesPrefix .'-timeout']); setcookie('Pman.timeout', -1, time() + (30*60), '/'); - + return false; } // http basic auth.. @@ -285,7 +288,10 @@ class Pman_Core_DataObjects_Core_person extends DB_DataObject && $u->checkPassword($_SERVER['PHP_AUTH_PW']) ) { + // logged in via http auth + $_SESSION[get_class($this)][$sesPrefix .'-auth'] = serialize($u); + self::$authUser = $u; return true; } //die("test init");