From f40740c3826276833e2a8aeaae3fb76549bd40e9 Mon Sep 17 00:00:00 2001 From: sharvey Date: Wed, 24 Feb 2010 22:34:53 +0000 Subject: [PATCH] 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 --- install.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/install.php b/install.php index ac4a2d5..073fe86 100644 --- a/install.php +++ b/install.php @@ -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 */