• Hi

    I’m looking for WP autogenerated user passwords (the ones sent in emails) to be simpler.

    I’ve tried to over-write wp_generate_password in the theme functions.php file. But this crashes the site. I expect because wp_generate_password has implications above just password generation (perhaps used for saltshashparties or something)?

    Can someone point me in right direction to do this, where it wont screw the rest of the site?

    thanks Pao

    BTW. I’m not interested in having a discussion about why I shouldn’t do this; (put simply, user experience and “user leakage” trumps the risk associated with having slightly weaker passwords)

Viewing 1 replies (of 1 total)
  • Thread Starter paolodit

    (@paolodit)

    I saw this on the web, but when I add it to the theme functions.php it breaks the site:

    function wp_generate_password( $length = 8, $special_chars = false ) {
    	/* simpler password generation */
     srand((double)microtime()*1000000);
      $vowels = array("a", "e", "i", "o", "u");
      $cons = array("b", "c", "d", "g", "h", "j", "k", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr", "cr", "br", "fr", "th", "dr", "ch", "ph", "wr", "st", "sp", "sw", "pr", "sl", "cl");
      $num_vowels = count($vowels);
      $num_cons = count($cons);
      for($i = 0; $i < $length; $i++){
          $password .= $cons[rand(0, $num_cons - 1)] . $vowels[rand(0, $num_vowels - 1)];
      }
      $password =  substr($password, 0, $length); 
    
        // random_password filter was previously in random_password function which was deprecated
      return apply_filters('random_password', $password);
    
      }

    I assume because wordpress uses this function for OTHER things other than password generation?

    any insight anyone? Appreciated 🙂 THanks

Viewing 1 replies (of 1 total)

The topic ‘wp_generate_password simpler passwords please?’ is closed to new replies.