diff --git a/phpBB/includes/usercp_register.php b/phpBB/includes/usercp_register.php index 4c92af339b..13766c63ca 100644 --- a/phpBB/includes/usercp_register.php +++ b/phpBB/includes/usercp_register.php @@ -395,6 +395,9 @@ if ( isset($HTTP_POST_VARS['submit']) ) { $user_active = 0; $user_actkey = gen_rand_string(true); + $key_len = 54 - (strlen($server_url)); + $key_len = ($key_len > 6) ? $key_len : 6; + $user_actkey = substr($user_actkey, 0, $key_len); if ( $userdata['session_logged_in'] ) { @@ -489,6 +492,9 @@ if ( isset($HTTP_POST_VARS['submit']) ) if ( $board_config['require_activation'] == USER_ACTIVATION_SELF || $board_config['require_activation'] == USER_ACTIVATION_ADMIN || $coppa ) { $user_actkey = gen_rand_string(true); + $key_len = 54 - (strlen($server_url)); + $key_len = ( $key_len > 6 ) ? $key_len : 6; + $user_actkey = substr($user_actkey, 0, $key_len); $sql .= "0, '" . str_replace("\'", "''", $user_actkey) . "')"; } else @@ -922,4 +928,4 @@ $template->pparse('body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); -?> \ No newline at end of file +?> diff --git a/phpBB/includes/usercp_sendpasswd.php b/phpBB/includes/usercp_sendpasswd.php index 2ca37ffb6b..b060f75fcf 100644 --- a/phpBB/includes/usercp_sendpasswd.php +++ b/phpBB/includes/usercp_sendpasswd.php @@ -48,6 +48,9 @@ if ( isset($HTTP_POST_VARS['submit']) ) $username = $row['username']; $user_actkey = gen_rand_string(true); + $key_len = 54 - strlen($server_url); + $key_len = ( $str_len > 6 ) ? $key_len : 6; + $user_actkey = substr($user_actkey, 0, $key_len); $user_password = gen_rand_string(false); $sql = "UPDATE " . USERS_TABLE . " @@ -128,4 +131,4 @@ $template->pparse('body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); -?> \ No newline at end of file +?>