Check the password set in the install against the default rules

git-svn-id: file:///svn/phpbb/trunk@5776 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames 2006-04-08 18:34:13 +00:00
parent 3db7073415
commit 5b24c3a7fb
2 changed files with 18 additions and 2 deletions

View file

@ -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),

View file

@ -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 ]',
@ -128,6 +129,8 @@ $lang = array_merge($lang, array(
'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_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',