ENHANCEMENT #5024 Installer now checks that the user has entered a username and password correctly for the default admin, an additional button for re-checking requirements is now found at the bottom of the admin configuration section

ENHANCEMENT Error messages for database AND admin configuration are now in the same place at the top of the installer (from r99841)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/trunk@112182 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sminnee 2010-10-13 04:21:56 +00:00
parent acbe3b9058
commit cf647f463e

View File

@ -118,7 +118,7 @@ if(isset($_REQUEST['admin'])) {
if($usingEnv) {
$_REQUEST['admin'] = $adminConfig = array(
'username' => defined('SS_DEFAULT_ADMIN_USERNAME') ? SS_DEFAULT_ADMIN_USERNAME : 'admin',
'password' => defined('SS_DEFAULT_ADMIN_PASSWORD') ? SS_DEFAULT_ADMIN_PASSWORD : 'password',
'password' => defined('SS_DEFAULT_ADMIN_PASSWORD') ? SS_DEFAULT_ADMIN_PASSWORD : '',
'firstname' => $_REQUEST['admin']['firstname'],
'surname' => $_REQUEST['admin']['surname']
);
@ -128,7 +128,7 @@ if(isset($_REQUEST['admin'])) {
} else {
$_REQUEST['admin'] = $adminConfig = array(
'username' => defined('SS_DEFAULT_ADMIN_USERNAME') ? SS_DEFAULT_ADMIN_USERNAME : 'admin',
'password' => defined('SS_DEFAULT_ADMIN_PASSWORD') ? SS_DEFAULT_ADMIN_PASSWORD : 'password',
'password' => defined('SS_DEFAULT_ADMIN_PASSWORD') ? SS_DEFAULT_ADMIN_PASSWORD : '',
'firstname' => '',
'surname' => ''
);
@ -173,6 +173,11 @@ if($databaseConfig) {
$dbReq->checkdatabase($databaseConfig);
}
if($adminConfig) {
$adminReq = new InstallRequirements();
$adminReq->checkAdminConfig($adminConfig);
}
// Actual processor
$installFromCli = (isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'install');
@ -259,6 +264,15 @@ class InstallRequirements {
}
}
function checkAdminConfig($adminConfig) {
if(!$adminConfig['username']) {
$this->error(array('', 'Please enter a username!'));
}
if(!$adminConfig['password']) {
$this->error(array('', 'Please enter a password!'));
}
}
/**
* Check everything except the database
*/