Commit a1120005ee021e42065871fef6b65911bbd92def

Authored by Michael Joseph
1 parent 827bbac7

fixed logout and improved logging


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1030 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/authentication/Authenticator.inc
... ... @@ -28,7 +28,7 @@ class Authenticator {
28 28 if ($this->checkPassword($sUserName, $sPassword)) {
29 29 // retrieve the userID
30 30 $iUserID = lookupID($default->owl_users_table, "username", "$sUserName");
31   - $default->log->info("Authenticator::login authenticated user, id=$iUserID");
  31 + $default->log->info("Authenticator::login authenticated ($sUserName, $sPassword), id=$iUserID");
32 32 if ($iUserID) {
33 33 // add this to the return array
34 34 $aUserDetails["userID"] = $iUserID;
... ... @@ -37,11 +37,12 @@ class Authenticator {
37 37 Session::removeStaleSessions($aUserDetails["userID"]);
38 38  
39 39 // Check if Maxsessions has been reached
40   - // lookup maxsessions
  40 + // FIXME: make this check work before production install
41 41 $maxSessions = lookupField($default->owl_users_table, "max_sessions", "id", $iUserID);
  42 + $default->log->debug("maxsessions=$maxSessions for userID=$iUserID");
42 43 $sql = $default->db;
43 44 if ($sql->query("SELECT * FROM $default->owl_sessions_table WHERE user_id = '".$aUserDetails["user_id"]."'")) {
44   - if ($sql->num_rows($sql) >= $maxSessions) {
  45 + if ($sql->num_rows() >= $maxSessions) {
45 46 // return too many sessions status code
46 47 $aUserDetails["status"] = 3;
47 48 } else {
... ... @@ -61,6 +62,7 @@ class Authenticator {
61 62 $aUserDetails["status"] = 0;
62 63 }
63 64 } else {
  65 + $default->log->info("Authenticator::login login failed ($sUserName, $sPassword)");
64 66 // authentication failed
65 67 $aUserDetails["status"] = 0;
66 68 }
... ... @@ -73,9 +75,9 @@ class Authenticator {
73 75 * @param int the ID of user logging out
74 76 * @param string the user's sessionID
75 77 */
76   - function logout($iUserID, $iSessionID) {
  78 + function logout() {
77 79 // remove session from db
78   - Session::destroy($iSessionID);
  80 + Session::destroy();
79 81 }
80 82  
81 83 /**
... ...