diff --git a/administrator/components/com_finder/src/Controller/IndexerController.php b/administrator/components/com_finder/src/Controller/IndexerController.php index 6a49518ee69cc..f0cce7356d08a 100644 --- a/administrator/components/com_finder/src/Controller/IndexerController.php +++ b/administrator/components/com_finder/src/Controller/IndexerController.php @@ -39,6 +39,14 @@ class IndexerController extends BaseController */ public function start() { + // Check for a valid token. If invalid, send a 403 with the error message. + if (!Session::checkToken('request')) + { + static::sendResponse(new \Exception(Text::_('JINVALID_TOKEN_NOTICE'), 403)); + + return; + } + $params = ComponentHelper::getParams('com_finder'); if ($params->get('enable_logging', '0')) @@ -61,9 +69,6 @@ public function start() // We don't want this form to be cached. $this->app->allowCache(false); - // Check for a valid token. If invalid, send a 403 with the error message. - Session::checkToken('request') or static::sendResponse(new \Exception(Text::_('JINVALID_TOKEN_NOTICE'), 403)); - // Put in a buffer to silence noise. ob_start(); @@ -107,6 +112,14 @@ public function start() */ public function batch() { + // Check for a valid token. If invalid, send a 403 with the error message. + if (!Session::checkToken('request')) + { + static::sendResponse(new \Exception(Text::_('JINVALID_TOKEN_NOTICE'), 403)); + + return; + } + $params = ComponentHelper::getParams('com_finder'); if ($params->get('enable_logging', '0')) @@ -129,9 +142,6 @@ public function batch() // We don't want this form to be cached. $this->app->allowCache(false); - // Check for a valid token. If invalid, send a 403 with the error message. - Session::checkToken('request') or static::sendResponse(new \Exception(Text::_('JINVALID_TOKEN_NOTICE'), 403)); - // Put in a buffer to silence noise. ob_start(); @@ -242,12 +252,17 @@ public function batch() */ public function optimize() { + // Check for a valid token. If invalid, send a 403 with the error message. + if (!Session::checkToken('request')) + { + static::sendResponse(new \Exception(Text::_('JINVALID_TOKEN_NOTICE'), 403)); + + return; + } + // We don't want this form to be cached. $this->app->allowCache(false); - // Check for a valid token. If invalid, send a 403 with the error message. - Session::checkToken('request') or static::sendResponse(new \Exception(Text::_('JINVALID_TOKEN_NOTICE'), 403)); - // Put in a buffer to silence noise. ob_start(); diff --git a/administrator/components/com_finder/src/Response/Response.php b/administrator/components/com_finder/src/Response/Response.php index 7842fb346ef64..95a1f400c625c 100644 --- a/administrator/components/com_finder/src/Response/Response.php +++ b/administrator/components/com_finder/src/Response/Response.php @@ -41,9 +41,6 @@ public function __construct($state) Log::addLogger($options); } - // The old token is invalid so send a new one. - $this->token = Factory::getSession()->getFormToken(); - // Check if we are dealing with an error. if ($state instanceof \Exception) { diff --git a/build/media_source/com_finder/js/indexer.es6.js b/build/media_source/com_finder/js/indexer.es6.js index 2ef4243228781..32a891b8b3951 100644 --- a/build/media_source/com_finder/js/indexer.es6.js +++ b/build/media_source/com_finder/js/indexer.es6.js @@ -139,9 +139,6 @@ removeElement('progress'); - if (data) { - data = data.responseText !== null ? data.evaluate(data.responseText, true) : data; - } const header = data ? data.header : Joomla.JText._('COM_FINDER_AN_ERROR_HAS_OCCURRED'); const message = data ? data.message : `${Joomla.JText._('COM_FINDER_MESSAGE_RETURNED')}
${data}`;