diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Tracker/Request.php | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/core/Tracker/Request.php b/core/Tracker/Request.php index 8698a6dbda..c19ed8a619 100644 --- a/core/Tracker/Request.php +++ b/core/Tracker/Request.php @@ -198,6 +198,19 @@ class Request return false; } + // Now checking the list of admin token_auth cached in the Tracker config file + if (!empty($idSite) && $idSite > 0) { + $website = Cache::getCacheWebsiteAttributes($idSite); + $userModel = new \Piwik\Plugins\UsersManager\Model(); + $tokenAuthHashed = $userModel->hashTokenAuth($tokenAuth); + $hashedToken = UsersManager::hashTrackingToken((string) $tokenAuthHashed, $idSite); + + if (array_key_exists('tracking_token_auth', $website) + && in_array($hashedToken, $website['tracking_token_auth'], true)) { + return true; + } + } + Piwik::postEvent('Request.initAuthenticationObject'); /** @var \Piwik\Auth $auth */ @@ -212,19 +225,6 @@ class Request return true; } - // Now checking the list of admin token_auth cached in the Tracker config file - if (!empty($idSite) && $idSite > 0) { - $website = Cache::getCacheWebsiteAttributes($idSite); - $userModel = new \Piwik\Plugins\UsersManager\Model(); - $tokenAuth = $userModel->hashTokenAuth($tokenAuth); - $hashedToken = UsersManager::hashTrackingToken((string) $tokenAuth, $idSite); - - if (array_key_exists('tracking_token_auth', $website) - && in_array($hashedToken, $website['tracking_token_auth'], true)) { - return true; - } - } - Common::printDebug("WARNING! token_auth = $tokenAuth is not valid, Super User / Admin / Write was NOT authenticated"); /** |