Pluggable random password generator from pishmishy. fixes #5401

git-svn-id: https://develop.svn.wordpress.org/trunk@6385 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-12-15 05:31:16 +00:00
parent 95e4e8c822
commit 5918e8cf1c
5 changed files with 23 additions and 9 deletions

View File

@@ -744,4 +744,18 @@ function wp_check_password($password, $hash) {
}
endif;
if ( !function_exists('wp_generate_password') ) :
/**
* Generates a random password drawn from the defined set of characters
* @return string the password
**/
function wp_generate_password() {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$length = 7;
$password = '';
for ( $i = 0; $i < $length; $i++ )
$password .= substr($chars, mt_rand(0, 61), 1);
return $password;
}
endif;
?>