fix sending from non dataobject source
[Pman.Base] / Pman / Login.php
index f7e1047..6a20063 100644 (file)
@@ -47,7 +47,7 @@ class Pman_Login extends Pman
     {
         $this->initErrorHandling();
         
-         //DB_DataObject::DebugLevel(1);
+         // DB_DataObject::DebugLevel(5);
         if (!empty($_REQUEST['logout'])) {
            return $this->logout();
         }
@@ -234,7 +234,7 @@ class Pman_Login extends Pman
         if(!$u->loginPublic()){
             $this->jerr('Switch fail');
         }
-        
+         
         $this->jok('OK');
     }
     
@@ -252,6 +252,12 @@ class Pman_Login extends Pman
         if (!empty($_REQUEST['logout'])) {
            return $this->logout();
         }
+         
+        if(!empty($_REQUEST['check_owner_company'])) {
+            $core_company = DB_DataObject::factory('core_company');
+            $core_company->comptype = 'OWNER';
+            $this->jok($core_company->count());
+        }
         
         if (!empty($_REQUEST['passwordRequest'])) { //|| (strpos($_REQUEST['username'], '@') < 1)) {
             return $this->passwordRequest($_REQUEST['passwordRequest']);   
@@ -329,12 +335,12 @@ class Pman_Login extends Pman
             exit;
         }
         
-        if (!$u->active()) {
+        if (!$u->active()) { 
             $this->jerror('LOGIN-BAD','Account disabled');
         }
         
         if(!empty($u->oath_key) && empty($_REQUEST['oath_password'])){
-            $this->jerror('LOGIN-BAD','Your account requires Two-Factor Authentication');
+            $this->jerror('LOGIN-2FA','Your account requires Two-Factor Authentication');
         }
         
         // check if config allows non-owner passwords.
@@ -578,22 +584,22 @@ class Pman_Login extends Pman
             
             $core_ip_access->sendXMPP();
             
-            $this->jerr('NEW-IP-ADDRESS', array('ip' => $ip));
+            $this->jerror('NEW-IP-ADDRESS', "New IP Address = needs approving", array('ip' => $ip));
             
             return;
         }
         
         if(empty($core_ip_access->status)){
-            $this->jerr('PENDING-IP-ADDRESS', array('ip' => $ip));
+            $this->jerror('PENDING-IP-ADDRESS', "IP is still pending approval", array('ip' => $ip));
         }
         
         if($core_ip_access->status == -1){
-            $this->jerr('BLOCKED-IP-ADDRESS', array('ip' => $ip));
+            $this->jerror('BLOCKED-IP-ADDRESS', "Your IP is blocked", array('ip' => $ip));
             return;
         }
         
         if($core_ip_access->status == -2 && strtotime($core_ip_access->expire_dt) < strtotime('NOW')){
-            $this->jerr('BLOCKED-IP-ADDRESS', array('ip' => $ip));
+            $this->jerrpr('BLOCKED-IP-ADDRESS', "Your IP is blocked", array('ip' => $ip));
             return;
         }