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


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/phpinstaller/branches/2.4@99841 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
sharvey 2010-02-24 22:34:53 +00:00 committed by Sam Minnee
parent a9786bf089
commit f40740c382

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
*/