Title: Retrieve password: keys doesn&#8217;t match.
Last modified: August 19, 2016

---

# Retrieve password: keys doesn’t match.

 *  Resolved [Covi](https://wordpress.org/support/users/covi/)
 * (@covi)
 * [18 years ago](https://wordpress.org/support/topic/problem-with-retrieve-password/)
 * Hi all… I think this is my first topic on support.
    At first, please, sorry by
   lang 🙁
 * I don’t know if could be a bug but… i have a little problem with retrieve password
   function:
 * `retrieve_password()`
    1. The function generates and returns an user_activation_key,
   with extra characters, that inserts on the user field of database. 2. The function
   sends correctly this key ($key), also with these extra characters. `wp_generate_password(
   20, false)`
 * `reset_password($key)`
    But the check function for this key ($key), retrieves
   an clean key of these characters: `$key = preg_replace('/[^a-z0-9]/i', '', $key);`
 * So, this is the problem:
    **the key saved in the DataBase doesn’t match with 
   the key sent by email** because reset_password($key) cleans the key of these 
   extra characters.
 * Ummm… I think the md5() function never works.
 * —
    My temporally correction it’s apply the same replacement of Key sent in the
   key that we have retrieved:
 *     ```
       function reset_password($key) {
       global $wpdb;
   
       // Mod by Covi: FIXME - Error, activation_key have extra characters:
       $key = preg_replace('/[^a-z0-9]/i', '', $key);
       if ( empty( $key ) )[...]
       ```
   
 * I’m sure the problem is mine, but… someone can help me? 😉
 * Regards and sorry by lang again.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [18 years ago](https://wordpress.org/support/topic/problem-with-retrieve-password/#post-759373)
 * I believe this is a known problem that should be fixed with 2.5.2.
 * In the meantime take a look at [trac ticket 6842](http://trac.wordpress.org/ticket/6842).
 * Please note I moved this from the Installation to the How-to and Troubleshooting
   Forum.
 *  Thread Starter [Covi](https://wordpress.org/support/users/covi/)
 * (@covi)
 * [18 years ago](https://wordpress.org/support/topic/problem-with-retrieve-password/#post-759458)
 * Ok, I will remember the appropiated forum ^^
    Thanks a lot, mate 😉
 *  [taicycling](https://wordpress.org/support/users/taicycling/)
 * (@taicycling)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/problem-with-retrieve-password/#post-759542)
 * I finally got around to updating to 2.5.1 and when WP updated my database it 
   threw in the bad key error and disabled my login ability. I had to remove the“(”
   character from the end of the key inside myPHPadmin to get it to work. My point
   is I never lost my password but the update nullified it somehow… I don’t have
   any clue what happened there but maybe it’ll be fixed along with the original
   problem in the 2.5.2 release.
 *  Thread Starter [Covi](https://wordpress.org/support/users/covi/)
 * (@covi)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/problem-with-retrieve-password/#post-759554)
 * Taicy, check the “Trac” on the link of MicahelH 😉
    I used this fix: [http://trac.wordpress.org/changeset/7837](http://trac.wordpress.org/changeset/7837)
 * S!, Covi.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Retrieve password: keys doesn’t match.’ is closed to new replies.

## Tags

 * [password](https://wordpress.org/support/topic-tag/password/)
 * [retrieve](https://wordpress.org/support/topic-tag/retrieve/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Covi](https://wordpress.org/support/users/covi/)
 * Last activity: [17 years, 10 months ago](https://wordpress.org/support/topic/problem-with-retrieve-password/#post-759554)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
