From 500ba8b11e17adcb477e152a644bf322779fda94 Mon Sep 17 00:00:00 2001 From: Jerome Mouneyrac Date: Wed, 2 Nov 2011 09:38:02 +0800 Subject: [PATCH] MDL-30043 token.php should not return a mix of EXTERNAL_TOKEN_PERMANENT and EXTERNAL_TOKEN_EMBEDDED --- login/token.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/login/token.php b/login/token.php index ff8e86d1958..e8f732daced 100644 --- a/login/token.php +++ b/login/token.php @@ -94,9 +94,9 @@ if (!empty($user)) { // It does not really matter we take the first one that is valid. $tokenssql = "SELECT t.id, t.sid, t.token, t.validuntil, t.iprestriction FROM {external_tokens} t - WHERE t.userid = ? AND t.externalserviceid = ? + WHERE t.userid = ? AND t.externalserviceid = ? AND t.tokentype = ? ORDER BY t.timecreated ASC"; - $tokens = $DB->get_records_sql($tokenssql, array($user->id, $service->id)); + $tokens = $DB->get_records_sql($tokenssql, array($user->id, $service->id, EXTERNAL_TOKEN_PERMANENT)); //A bit of sanity checks foreach ($tokens as $key=>$token) {