Fix blank error when not submitting any passwords during registration and alter error when no username is input

git-svn-id: file:///svn/phpbb/trunk@2387 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-03-21 13:27:38 +00:00
parent 78a87c5720
commit c89f896c27

View file

@ -53,27 +53,11 @@ function show_coppa(&$coppa)
$template->pparse('body'); $template->pparse('body');
}
function parse_variables()
{
}
function process_data()
{
}
function show_profile_page()
{
} }
// //
// //
// //
$page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register']; $page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];
if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) ) if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GET_VARS['agreed']) )
@ -89,7 +73,6 @@ if ( $mode == 'register' && !isset($HTTP_POST_VARS['agreed']) && !isset($HTTP_GE
} }
} }
$coppa = ( ( !$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa'] ) || $mode == 'register' ) ? 0 : TRUE; $coppa = ( ( !$HTTP_POST_VARS['coppa'] && !$HTTP_GET_VARS['coppa'] ) || $mode == 'register' ) ? 0 : TRUE;
if ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar']) || $mode == 'register' ) if ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar']) || $mode == 'register' )
@ -126,7 +109,7 @@ if ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['avatargallery'])
$username = str_replace(' ', '', $username); $username = str_replace(' ', '', $username);
$email = htmlspecialchars($email); $email = htmlspecialchars($email);
$signature = str_replace('<br />', '\n', $signature); $signature = str_replace('<br />', "\n", $signature);
// Run some validation on the optional fields. These are pass-by-ref, so they'll be changed to // Run some validation on the optional fields. These are pass-by-ref, so they'll be changed to
// empty strings if they fail. // empty strings if they fail.
@ -202,17 +185,6 @@ if ( isset($HTTP_POST_VARS['submit']) || isset($HTTP_POST_VARS['avatargallery'])
} }
} }
if ( isset($HTTP_POST_VARS['submit']) ) if ( isset($HTTP_POST_VARS['submit']) )
{ {
include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx); include($phpbb_root_path . 'includes/usercp_avatar.'.$phpEx);
@ -281,7 +253,12 @@ if ( isset($HTTP_POST_VARS['submit']) )
} }
} }
} }
else if ( ( $password && !$password_confirm ) || ( !$password && $password_confirm ) ) else if ( empty($password) && empty($password_confirm) )
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
}
else
{ {
$error = TRUE; $error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch']; $error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Password_mismatch'];
@ -326,7 +303,12 @@ if ( isset($HTTP_POST_VARS['submit']) )
$username_sql = ''; $username_sql = '';
if ( $board_config['allow_namechange'] || $mode == 'register' ) if ( $board_config['allow_namechange'] || $mode == 'register' )
{ {
if ( $username != $userdata['username'] || $mode == 'register' ) if ( empty($username) )
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Username_disallowed'];
}
else if ( $username != $userdata['username'] || $mode == 'register' )
{ {
$result = validate_username($username); $result = validate_username($username);
if ( $result['error'] ) if ( $result['error'] )
@ -409,9 +391,6 @@ if ( isset($HTTP_POST_VARS['submit']) )
$user_active = 0; $user_active = 0;
$user_actkey = gen_rand_string(true); $user_actkey = gen_rand_string(true);
//
// The user is inactive, remove their session forcing them to login again before they can post.
//
if ( $userdata['session_logged_in'] ) if ( $userdata['session_logged_in'] )
{ {
session_end($userdata['session_id'], $userdata['user_id']); session_end($userdata['session_id'], $userdata['user_id']);
@ -626,15 +605,6 @@ if ( isset($HTTP_POST_VARS['submit']) )
} }
} }
if ( $error ) if ( $error )
{ {
// //
@ -699,21 +669,9 @@ else if ( $mode == 'editprofile' && !isset($HTTP_POST_VARS['avatargallery']) &&
$user_dateformat = $userdata['user_dateformat']; $user_dateformat = $userdata['user_dateformat'];
} }
//
// Default pages
//
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(