mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Add arg to make special chars optional when generating passwords. fixes #6842 for trunk
git-svn-id: https://develop.svn.wordpress.org/trunk@7836 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1168,8 +1168,11 @@ if ( !function_exists('wp_generate_password') ) :
|
||||
*
|
||||
* @return string The random password
|
||||
**/
|
||||
function wp_generate_password($length = 12) {
|
||||
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()";
|
||||
function wp_generate_password($length = 12, $special_chars = true) {
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
if ( $special_chars )
|
||||
$chars .= '!@#$%^&*()';
|
||||
|
||||
$password = '';
|
||||
for ( $i = 0; $i < $length; $i++ )
|
||||
$password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
|
||||
|
||||
Reference in New Issue
Block a user