Pman/Login.php
[Pman.Base] / Pman / Login.php
index 086a218..5b1cd01 100644 (file)
@@ -91,10 +91,12 @@ class Pman_Login extends Pman
             $this->jok(array('id' => 0)); // not logged in..
             exit;
         }
-        
-         $ff= HTML_FlexyFramework::get();
-        if (!empty($ff->Pman['auth_comptype']) && $ff->Pman['auth_comptype'] != $u->company()->comptype) {
-            $this->jerr("Login not permited to outside companies");
+        $au = $u->getAuthUser();
+        // might occur on shared systems.
+        $ff= HTML_FlexyFramework::get();
+        if (!empty($ff->Pman['auth_comptype']) && $ff->Pman['auth_comptype'] != $au->company()->comptype) {
+            $au->logout();
+            $this->jerr("Login not permited to outside companies - please reload");
         }
         
         
@@ -104,6 +106,21 @@ class Pman_Login extends Pman
          
         /** -- these need modulizing somehow! **/
         
+        
+        
+        // basically calls Pman_MODULE_Login::sendAuthUserDetails($aur) on all the modules
+        
+        foreach($this->modules() as $m) {
+            if (!file_exists($this->rootDir.'/Pman/'.$m.'/Login.php')) {
+                continue;
+            }
+            $cls = 'Pman_'.$m.'_Login';
+            require_once 'Pman/'.$m.'/Login.php';
+            $x = new $cls;
+            $aur = $x->sendAuthUserDetails($aur);
+        }
+        
+                
         if ($this->hasModule('Fax')) {
             // should check fax module???
             $f = DB_DataObject::factory('Fax_Queue');