summaryrefslogtreecommitdiff
path: root/modules/user.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2006-01-15 16:57:56 +0000
committerDries Buytaert <dries@buytaert.net>2006-01-15 16:57:56 +0000
commitf649b42d9c3d654da63d38be28ba0eda1aa24ef0 (patch)
treeab334b66d252a830dfc031531db9546cbf069c18 /modules/user.module
parent84beb25884b2e45d245ba2d8367d6b1306cd27cb (diff)
downloadbrdo-f649b42d9c3d654da63d38be28ba0eda1aa24ef0.tar.gz
brdo-f649b42d9c3d654da63d38be28ba0eda1aa24ef0.tar.bz2
- Patch #44767 by jvandyk: small (code) improvements
Diffstat (limited to 'modules/user.module')
-rw-r--r--modules/user.module13
1 files changed, 5 insertions, 8 deletions
diff --git a/modules/user.module b/modules/user.module
index e9b911587..981e902bf 100644
--- a/modules/user.module
+++ b/modules/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;