Commit 157983e8 authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 240004: limit the password generation subroutine to nice…

Patch for bug 240004: limit the password generation subroutine to nice characters only; patch by Paul Wallingford <bugzilla@steeleware.com>; r=vladd; a=justdave.
parent 1a60a57c
......@@ -426,28 +426,8 @@ sub InsertNewUser {
}
sub GenerateRandomPassword {
my ($size) = @_;
# Generated passwords are eight characters long by default.
$size ||= 8;
# The list of characters that can appear in a randomly generated password.
# Note that users can put any character into a password they choose
# themselves.
my @pwchars = (0..9, 'A'..'Z', 'a'..'z', '-', '_', '!', '@', '#', '$',
'%', '^', '*');
# The number of characters in the list.
my $pwcharslen = scalar(@pwchars);
# Generate the password.
my $password = "";
for ( my $i=0 ; $i<$size ; $i++ ) {
$password .= $pwchars[rand($pwcharslen)];
}
# Return the password.
return $password;
my $size = (shift or 10); # default to 10 chars if nothing specified
return join("", map{ ('0'..'9','a'..'z','A'..'Z')[rand 62] } (1..$size));
}
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment