public function getTokenAuth($userLogin, $md5Password)
    {
        UsersManager::checkPasswordHash($md5Password, Piwik::translate('UsersManager_ExceptionPasswordMD5HashExpected'));

        $user = $this->model->getUser($userLogin);

        if (empty($user) || !$this->password->verify($md5Password, $user['password'])) {
            /**
             * @ignore
             * @internal
             */
            Piwik::postEvent('Login.authenticate.failed', array($userLogin));

            return md5($userLogin . microtime(true) . Common::generateUniqId());
        }

        if ($this->password->needsRehash($user['password'])) {
            $userUpdater = new UserUpdater();
            $userUpdater->updateUserWithoutCurrentPassword($userLogin, $this->password->hash($md5Password));
        }

        return $user['token_auth'];
    }