summaryrefslogtreecommitdiffstats
path: root/wp-includes
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-17 17:25:38 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-10-17 17:25:38 +0000
commitdc5d4415dc609ee563cbcac8147677c16250f964 (patch)
treefb17e2750515ec8f2492128f74331a34d6c26769 /wp-includes
parentd2bd94baf9b13c930cd07119c5875750f7bd3a2b (diff)
downloadwordpress-mu-dc5d4415dc609ee563cbcac8147677c16250f964.tar.gz
wordpress-mu-dc5d4415dc609ee563cbcac8147677c16250f964.tar.xz
wordpress-mu-dc5d4415dc609ee563cbcac8147677c16250f964.zip
Better random_number_generator() by tellyworth, fixes #440
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1093 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes')
-rw-r--r--wp-includes/wpmu-functions.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/wp-includes/wpmu-functions.php b/wp-includes/wpmu-functions.php
index 6c8664b..b5e2c60 100644
--- a/wp-includes/wpmu-functions.php
+++ b/wp-includes/wpmu-functions.php
@@ -1251,10 +1251,20 @@ function wpmu_activate_signup($key) {
return array('blog_id' => $blog_id, 'user_id' => $user_id, 'password' => $password, 'title' => $signup->title, 'meta' => $meta);
}
-function generate_random_password() {
- $random_password = substr(md5(uniqid(microtime())), 0, 6);
- $random_password = apply_filters('random_password', $random_password);
- return $random_password;
+function generate_random_password($len=8) {
+ $keys = array(
+ 'qwertasdfgzxcvb2345', // left hand
+ 'yuiophjknm6789' // right hand
+ );
+
+ // generate a password with alternating left/right hand keys
+ $pass = '';
+ for ($i=0; $i<$len; $i++) {
+ $hand = $keys[$i%2];
+ $pass .= substr($hand, mt_rand(0, strlen($hand)-1), 1);
+ }
+
+ return apply_filters('random_password', $pass);
}
function wpmu_create_user( $user_name, $password, $email) {