From 5b24c3a7fb5eaef0c6a1374eff1435322097f0b9 Mon Sep 17 00:00:00 2001 From: Graham Eames Date: Sat, 8 Apr 2006 18:34:13 +0000 Subject: [PATCH] Check the password set in the install against the default rules git-svn-id: file:///svn/phpbb/trunk@5776 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/install_install.php | 15 ++++++++++++++- phpBB/language/en/install.php | 5 ++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index fe058b5e56..997c9ccf57 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -524,15 +524,28 @@ class install_install extends module { $error[] = $lang['INST_ERR_MISSING_DATA']; } + if ($admin_pass1 != $admin_pass2 && $admin_pass1 != '') { $error[] = $lang['INST_ERR_PASSWORD_MISMATCH']; } + // Test against the default password rules + if ($admin_pass1 != '' && strlen($admin_pass1) < 6) + { + $error[] = $lang['INST_ERR_PASSWORD_TOO_SHORT']; + } + + if ($admin_pass1 != '' && strlen($admin_pass1) > 30) + { + $error[] = $lang['INST_ERR_PASSWORD_TOO_LONG']; + } + if ($board_email1 != $board_email2 && $board_email1 != '') { $error[] = $lang['INST_ERR_EMAIL_MISMATCH']; } + if ($board_email1 != '' && !preg_match('#^[a-z0-9\.\-_\+]+?@(.*?\.)*?[a-z0-9\-_]+?\.[a-z]{2,4}$#i', $board_email1)) { $error[] = $lang['INST_ERR_EMAIL_INVALID']; @@ -1297,7 +1310,7 @@ class install_install extends module 'legend1' => 'ADMIN_CONFIG', 'language' => array('lang' => 'DEFAULT_LANG', 'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false), 'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => false), - 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => false), + 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true), 'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false), 'board_email1' => array('lang' => 'CONTACT_EMAIL', 'type' => 'text:25:100', 'explain' => false), 'board_email2' => array('lang' => 'CONTACT_EMAIL_CONFIRM', 'type' => 'text:25:100', 'explain' => false), diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 336819d020..3d186b5cd9 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -32,6 +32,7 @@ $lang = array_merge($lang, array( 'ADMIN_CONFIG' => 'Admin Configuration', 'ADMIN_PASSWORD' => 'Administrator password', 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', + 'ADMIN_PASSWORD_EXPLAIN' => '(Please enter a password between 6 and 30 characters is length)', 'ADMIN_TEST' => 'Check administrator settings', 'ADMIN_USERNAME' => 'Administrator username', 'APP_MAGICK' => 'Imagemagick support [ Attachments ]', @@ -127,7 +128,9 @@ $lang = array_merge($lang, array( 'INST_ERR_FTP_LOGIN' => 'Could not login to ftp server, check your username and password', 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block', 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type', - 'INST_ERR_PASSWORD_MISMATCH'=> 'The passwords you entered did not match.', + 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', + 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', + 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', 'NEXT_STEP' => 'Proceed to next step',