diff options
Diffstat (limited to 'modules/user/user.module')
-rw-r--r-- | modules/user/user.module | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/modules/user/user.module b/modules/user/user.module index e9b911587..981e902bf 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -285,14 +285,11 @@ function user_password($length = 10) { // This variable contains the list of allowable characters for the // password. Note that the number 0 and the letter 'O' have been // removed to avoid confusion between the two. The same is true - // of 'I' and 1. - $allowable_characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'; + // of 'I', 1, and l. + $allowable_characters = 'abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789'; - // We see how many characters are in the allowable list: - $len = strlen($allowable_characters); - - // Seed the random number generator with the microtime stamp. - mt_srand((double)microtime() * 1000000); + // Zero-based count of characters in the allowable list: + $len = strlen($allowable_characters) - 1; // Declare the password as a blank string. $pass = ''; @@ -302,7 +299,7 @@ function user_password($length = 10) { // Each iteration, pick a random character from the // allowable string and append it to the password: - $pass .= $allowable_characters[mt_rand(0, $len - 1)]; + $pass .= $allowable_characters[mt_rand(0, $len)]; } return $pass; |