diff --git a/installation/language/en-GB/en-GB.ini b/installation/language/en-GB/en-GB.ini index 57f25bae974c9..6b2ef7ec4e1c6 100644 --- a/installation/language/en-GB/en-GB.ini +++ b/installation/language/en-GB/en-GB.ini @@ -62,6 +62,7 @@ INSTL_DATABASE_NAME_LABEL="Database Name" INSTL_DATABASE_NO_SCHEMA="No database schema exists for this database type." INSTL_DATABASE_PASSWORD_DESC="Either a password you created or a password provided by your host." INSTL_DATABASE_PREFIX_DESC="Enter a table prefix or use the randomly generated one." +INSTL_DATABASE_PREFIX_MSG="The table prefix must start with a letter, optionally be followed by alphanumeric characters and by an underscore" INSTL_DATABASE_TYPE_DESC="Select the database type." INSTL_DATABASE_USER_DESC="Either a username you created or a username provided by your host." INSTL_DATABASE_VALIDATION_ERROR="Check your database credentials, database type, database name or hostname. If you have MySQL 8 installed then please read this wiki for more information." diff --git a/installation/language/en-US/en-US.ini b/installation/language/en-US/en-US.ini index 8bbf0858fa8c2..2e41192f20a8c 100644 --- a/installation/language/en-US/en-US.ini +++ b/installation/language/en-US/en-US.ini @@ -187,6 +187,7 @@ INSTL_DATABASE_INVALID_NAME="MySQL versions previous to 5.1.6 may not contain pe INSTL_DATABASE_NAME_INVALID_SPACES="MySQL database names and table names may not begin or end with spaces." INSTL_DATABASE_NAME_INVALID_CHAR="No MySQL identifier can contain a NULL ASCII(0x00)." INSTL_DATABASE_FILE_DOES_NOT_EXIST="File %s does not exist" +INSTL_DATABASE_PREFIX_MSG="The table prefix must start with a letter, optionally be followed by alphanumeric characters and by an underscore" ;controllers INSTL_COOKIES_NOT_ENABLED="Cookies do not appear to be enabled on your browser client. You will not be able to install the application with this feature disabled. Alternatively, there could also be a problem with the server's session.save_path. If this is the case, please consult your hosting provider if you don't know how to check or fix this yourself." diff --git a/installation/src/Controller/InstallationController.php b/installation/src/Controller/InstallationController.php index 333dfb0534fed..2e017cb202415 100644 --- a/installation/src/Controller/InstallationController.php +++ b/installation/src/Controller/InstallationController.php @@ -60,12 +60,17 @@ public function dbcheck() // Check the form /** @var \Joomla\CMS\Installation\Model\SetupModel $model */ $model = $this->getModel('Setup'); - if ($model->checkForm('setup') === false || $model->validateDbConnection() === false) + if ($model->checkForm('setup') === false) { - $r->messages = Text::_('INSTL_DATABASE_VALIDATION_ERROR'); - $r->view = 'setup'; + $this->app->enqueueMessage(Text::_('INSTL_DATABASE_VALIDATION_ERROR'), 'error'); + $r->validated = false; + $this->sendJsonResponse($r); + + return; } + $r->validated = $model->validateDbConnection(); + $this->sendJsonResponse($r); } diff --git a/installation/template/js/setup.js b/installation/template/js/setup.js index a90a6e0cd3a25..6daca3c6ec379 100644 --- a/installation/template/js/setup.js +++ b/installation/template/js/setup.js @@ -84,17 +84,16 @@ Joomla.checkDbCredentials = function() { headers: {'Content-Type': 'application/x-www-form-urlencoded'}, onSuccess: function(response, xhr){ response = JSON.parse(response); - Joomla.loadingLayer('hide'); + if (response.messages) { + Joomla.renderMessages(response.messages); + } + Joomla.replaceTokens(response.token); - if (response.data.messages) { - Joomla.loadingLayer('hide'); - Joomla.renderMessages({ - "error": [response.data.messages] - }); - // You shall not pass, DB credentials error!!!! - } else { - Joomla.loadingLayer('hide'); + Joomla.loadingLayer("hide"); + if (response.error) { + Joomla.renderMessages({'error': [response.message]}); + } else if (response.data && response.data.validated === true) { // Run the installer - we let this handle the redirect for now // TODO: Convert to promises Joomla.install(['config'], form);