Add length arg to wp_generate_password() and lengthen secret. Props tellyworth. fixes #6146 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@7796 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2008-04-24 00:19:09 +00:00
parent 1e811e8742
commit 4680f8f084
4 changed files with 15 additions and 6 deletions

View File

@@ -1167,12 +1167,11 @@ if ( !function_exists('wp_generate_password') ) :
*
* @return string The random password
**/
function wp_generate_password() {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$length = 7;
function wp_generate_password($length = 12) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";
$password = '';
for ( $i = 0; $i < $length; $i++ )
$password .= substr($chars, mt_rand(0, 61), 1);
$password .= substr($chars, mt_rand(0, strlen($chars)), 1);
return $password;
}
endif;