mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Allow more special characters in wp_generate_password() second pass. props sivel, see #12159
git-svn-id: http://svn.automattic.com/wordpress/trunk@13206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a60b801d5d
commit
91e0c6a98c
@ -1462,17 +1462,16 @@ if ( !function_exists('wp_generate_password') ) :
|
||||
*
|
||||
* @param int $length The length of password to generate
|
||||
* @param bool $special_chars Whether to include standard special characters. Default true.
|
||||
* @param bool $extra_special_chars Whether to include more special characters. Used
|
||||
* when generating secret keys and salts. Default false.
|
||||
* @param bool $extra_special_chars Whether to include other special characters. Used when
|
||||
* generating secret keys and salts. Default false.
|
||||
* @return string The random password
|
||||
**/
|
||||
function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
|
||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
if ( $special_chars ) {
|
||||
if ( $special_chars )
|
||||
$chars .= '!@#$%^&*()';
|
||||
if ( $extra_special_chars )
|
||||
$chars .= '-_ []{}<>~`+=,.;:/?|';
|
||||
}
|
||||
|
||||
$password = '';
|
||||
for ( $i = 0; $i < $length; $i++ ) {
|
||||
|
Loading…
Reference in New Issue
Block a user