From c73f734e1f02080d48edc1c2a6f918818f09bc90 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 11 Mar 2007 05:58:41 +0000 Subject: [PATCH] r1435: Fixed a bug in Authentication that could potentially cause the Bugdar user to be synced every time due to the fact that the values in bugdarUser[] aren't filled --- includes/auth/auth.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/includes/auth/auth.php b/includes/auth/auth.php index 566393f..64765ad 100644 --- a/includes/auth/auth.php +++ b/includes/auth/auth.php @@ -165,8 +165,11 @@ class Authentication if ($this->_verifyCookieData()) { $this->_setCookies(true); - $this->_syncBugdarUser(); $this->bugdarUser = $this->_fetchBugdarUserFromAuthUser(); + if ($this->_syncBugdarUser()) + { + $this->bugdarUser = $this->_fetchBugdarUserFromAuthUser(); + } return true; } else @@ -213,8 +216,8 @@ class Authentication if ($this->_verifyLoginUser($password)) { $this->_setCookies($sticky); - $this->_syncBugdarUser(); $this->bugdarUser = $this->_fetchBugdarUserFromAuthUser(); + $this->_syncBugdarUser(); return true; } else @@ -284,7 +287,7 @@ class Authentication * Syncs a Bugdar user's fieldMap'ed values to the authentication DB's * values. This allows the users to stay mostly-in-sync for the most * basic of information (like email, timezone, etc.). Passwords are - * NOT synced. + * NOT synced. Returns TRUE if the user data was changed. */ function _syncBugdarUser() { @@ -297,11 +300,11 @@ class Authentication $user = new UserAPI($this->registry); $user->set('userid', $this->authUser[ $this->fieldMap['authid'] ]); $user->set_condition(); - foreach ($fields AS $bugdar => $authdb) + foreach ($fields AS $bugdar => $auth) { - if ($this->bugdarUser["$bugdar"] != $this->authUser["$authDb"]) + if ($this->bugdarUser["$bugdar"] != $this->authUser["$auth"]) { - $user->set($bugdar, $this->authUser["$authdb"]); + $user->set($bugdar, $this->authUser["$auth"]); $change = true; } } @@ -309,6 +312,8 @@ class Authentication { $user->update(); } + + return $change; } // ################################################################### -- 2.43.5