WordPress.org

Ready to get started?Download WordPress

Forums

WP Password Generator
[resolved] [Plugin: WP-Password Generator] New feature request (3 posts)

  1. ronthai
    Member
    Posted 3 years ago #

    Would it be possible to have the option for the admin to choose the make up of the password? Now it is at random with #%$(&^)* and so on.

    I know that is to make the passwords strong, but it is also a pain in the B... for many of my members. Not everybody really knows how to simply copy and paste (yah, I could not believe it also).

    So an option to use only letters (small and capital) and numbers.
    And if possible avoiding iI1oO0, since depending on font used they also look many times the same.

    I know it is a really nonsence request, but my paying customers are complaining (well a few dumboos) and a password like Hyt53DExX97G4D3w is almost just as strong as hdt%34@CDf(7NJyg5

    Regards, Ron

    http://wordpress.org/extend/plugins/wp-password-generator/

  2. Steve Grunwell
    Member
    Plugin Author

    Posted 3 years ago #

    Hey ronthai,

    Previous versions of the plugin used a custom password generation function, but version 2.2 uses the built-in wp_generate_password() function. What's neat about this is wp_generate_password() is a pluggable function, which makes it easy to overwrite the function with whatever you'd like. "Forgot Password" requests also use wp_generate_password(), so overriding the pluggable function in your theme ensures that user passwords are consistent.

    I'd recommend taking a look at the source (wp-includes/pluggable.php:1558). If you want to make any changes (or completely rewrite the function), simply create a wp_generate_password() function in your theme's functions.php. For instance, you could drop in the following stripped down version (which removes special characters and iIlLoO0):

    function wp_generate_password( $length = 12 ) {
      $chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ23456789';
    
      $password = '';
      for ( $i = 0; $i < $length; $i++ ) {
        $password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
      }
    
      // random_password filter was previously in random_password function which was deprecated
      return apply_filters('random_password', $password);
    }

    Hope this helps,
    Steve

  3. ronthai
    Member
    Posted 3 years ago #

    Thanks for that, works excellent and apparently a lot easier then I thought.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic