phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.39


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.39
Date: Mon, 17 May 2004 17:03:20 +0200

Update of /sync/inc
Modified Files:
        Branch: 
          class.bo_sync.inc.php

date: 2004/05/17 15:03:20;  author: mkaemmerer;  state: Exp;  lines: +14 -9

Log Message:
- fixed authentification with already added devices
=====================================================================
Index: sync/inc/class.bo_sync.inc.php
diff -u sync/inc/class.bo_sync.inc.php:1.38 sync/inc/class.bo_sync.inc.php:1.39
--- sync/inc/class.bo_sync.inc.php:1.38 Fri May 14 19:00:28 2004
+++ sync/inc/class.bo_sync.inc.php      Mon May 17 15:03:20 2004
@@ -90,16 +90,21 @@
        
        function AuthenticateSyncDevice($URI, $username, $password)
     {
-      $deviceid = $this->so->GetDevice($URI, $username, $password);
+      $deviceid = $this->so->GetDeviceID($URI);
       if ($deviceid >= 0)
-      {
-        // device already exists
-        $ret = $deviceid;
-      } else
-      {
+      { // device is in database, test for username and password
+        $ret = $this->so->GetDevice($URI, $username, $password);
+        if ($ret < 0)
+        { 
+          error_log("Error: username/password not correct for device: [$URI], 
username: [$username]");
+        }
+      } 
+      else
+      { // device is not in database 
          // compare to phpGW username/password -> add device, if user exists
         if ($GLOBALS['phpgw']->auth->authenticate($username, $password, 
'text'))
         {
+          $test = $GLOBALS['phpgw']->auth->authenticate($username, $password, 
'text');
           $account = CreateObject('phpgwapi.accounts');
           $phpgw_accountid = $account->name2id($username);
           $ret = $this->so->AddDevice($phpgw_accountid, $URI, $username, 
$password);
@@ -108,7 +113,7 @@
           $ret = -1;
         }
       }
-      
+     
       // switch user if device is authorized and the user is different from 
current one
       if (($ret >= 0) and ($phpgw_accountid <> 
$GLOBALS['phpgw_info']['user']['account_id'])) 
       { 
@@ -117,7 +122,7 @@
        if ($this->debug)
          error_log("AuthenticateSyncDevice: got new session: " . $sess);     
       }
-
+      
       return array(
         'result'    => $ret,
         'sessionid' => $GLOBALS['phpgw']->session->sessionid,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]