phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] sync/inc/class.so_sync.inc.php, 1.26


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.so_sync.inc.php, 1.26
Date: Fri, 21 May 2004 21:19:57 -0000

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

date: 2004/04/28 17:42:44;  author: mkaemmerer;  state: Exp;  lines: +14 -9

Log Message:
- updated GetAccountIDfromUsername for generic authentication (from PK)
=====================================================================
Index: sync/inc/class.so_sync.inc.php
diff -u sync/inc/class.so_sync.inc.php:1.25 sync/inc/class.so_sync.inc.php:1.26
--- sync/inc/class.so_sync.inc.php:1.25 Mon Apr 26 14:58:04 2004
+++ sync/inc/class.so_sync.inc.php      Wed Apr 28 17:42:44 2004
@@ -96,17 +96,22 @@
     *
     * @param string $username name of user to authenticate
     * @param string $password clear text password of user to authenticate
-    * @return integer accountid or boolean false in case of non existent 
useraccount
+    * @return integer accountid or -1 in case of non existent or not valid 
useraccount
     */
     
     function GetAccountIDfromUsername($username, $password)
-    {
-      $db = $GLOBALS['phpgw']->db;
-      $db->query("SELECT account_id FROM phpgw_accounts WHERE account_lid = 
'$username' AND "
-        . "account_pwd='" . md5($password) . "' AND account_status 
='A'",__LINE__,__FILE__);
-      $db->next_record();
-
-      return $db->f('account_id');
+    { 
+      $valid = $GLOBALS['phpgw']->auth->authenticate($username, $password);
+      if ($valid)
+      {
+        $account = CreateObject('phpgwapi.accounts');
+        $id = $account->name2id($username);
+        if ($id)
+        {
+          return $id;
+        }
+      }
+      return -1;
     }
 
    /**




reply via email to

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