From 95915c38abb5b622f37ad343377c2e7652c3d40f Mon Sep 17 00:00:00 2001 From: Eileen Date: Wed, 9 Oct 2013 09:19:42 +1300 Subject: [PATCH] CRM-13487 fix on d6 authentication ---------------------------------------- * CRM-13487: User Authentication Bug in Drupal 6 http://issues.civicrm.org/jira/browse/CRM-13487 --- CRM/Utils/System/Drupal6.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CRM/Utils/System/Drupal6.php b/CRM/Utils/System/Drupal6.php index e77a067108..8e5bacc60d 100644 --- a/CRM/Utils/System/Drupal6.php +++ b/CRM/Utils/System/Drupal6.php @@ -714,7 +714,7 @@ SELECT name, mail if (!$loadUser) { return TRUE; } - + global $user; // If $uid is passed in, authentication has been done already. $uid = CRM_Utils_Array::value('uid', $params); if (!$uid) { @@ -723,21 +723,23 @@ SELECT name, mail $pass = CRM_Utils_Array::value('pass', $params, FALSE) ? $params['pass'] : trim(CRM_Utils_Array::value('pass', $_REQUEST)); if ($name) { - $uid = user_authenticate(array('name' => $name, 'pass' => $pass)); - if (!$uid) { + $user = user_authenticate(array('name' => $name, 'pass' => $pass)); + if (!$user->uid) { if ($throwError) { echo '
Sorry, unrecognized username or password.'; exit(); } return FALSE; } + else { + return TRUE; + } } } if ($uid) { $account = user_load($uid); if ($account && $account->uid) { - global $user; $user = $account; return TRUE; } -- 2.25.1