]> git.defcon.no Git - hermes/commitdiff
Brainfart, the new generate_password caused all passwords to have the same leading...
authorJon Langseth <jon.langseth@lilug.no>
Sat, 21 Jan 2012 01:37:56 +0000 (02:37 +0100)
committerJon Langseth <jon.langseth@lilug.no>
Sat, 21 Jan 2012 01:37:56 +0000 (02:37 +0100)
api/lib/user_functions.php

index e22412a6516ab2f80bd5d72d29895147b7ac447d..5aa1cfbe113bcb3574989c6cb791d97c1cdbba66 100644 (file)
@@ -12,10 +12,10 @@ function generate_password( $length = 24 )
        $string = "";
         while ( strlen( $string ) < $length )
         {
-               $string .= crypt(substr(md5(rand().rand()), 0, $length));
-               $string = preg_replace( '/\W/', '', $string);
+               $string .= crypt(substr(md5(rand().rand()), 0, $length+1));
+               $string = preg_replace( '/\W/', '', $string+1);
         }
-       return substr( $string, 0, $length );
+       return substr( $string, 1, $length );
 
 }