mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-11 02:49:04 +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 int $length The length of password to generate
|
||||||
* @param bool $special_chars Whether to include standard special characters. Default true.
|
* @param bool $special_chars Whether to include standard special characters. Default true.
|
||||||
* @param bool $extra_special_chars Whether to include more special characters. Used
|
* @param bool $extra_special_chars Whether to include other special characters. Used when
|
||||||
* when generating secret keys and salts. Default false.
|
* generating secret keys and salts. Default false.
|
||||||
* @return string The random password
|
* @return string The random password
|
||||||
**/
|
**/
|
||||||
function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
|
function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
|
||||||
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||||
if ( $special_chars ) {
|
if ( $special_chars )
|
||||||
$chars .= '!@#$%^&*()';
|
$chars .= '!@#$%^&*()';
|
||||||
if ( $extra_special_chars )
|
if ( $extra_special_chars )
|
||||||
$chars .= '-_ []{}<>~`+=,.;:/?|';
|
$chars .= '-_ []{}<>~`+=,.;:/?|';
|
||||||
}
|
|
||||||
|
|
||||||
$password = '';
|
$password = '';
|
||||||
for ( $i = 0; $i < $length; $i++ ) {
|
for ( $i = 0; $i < $length; $i++ ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user