Make WordPress Core


Ignore:
Timestamp:
08/11/2009 06:03:45 AM (15 years ago)
Author:
ryan
Message:

Pass user login when resetting passwords.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.8/wp-login.php

    r11800 r11804  
    162162    $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
    163163    $message .= __('To reset your password visit the following address, otherwise just ignore this email and nothing will happen.') . "\r\n\r\n";
    164     $message .= site_url("wp-login.php?action=rp&key=$key", 'login') . "\r\n";
     164    $message .= site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . "\r\n";
    165165
    166166    $title = sprintf(__('[%s] Password Reset'), get_option('blogname'));
     
    183183 * @return bool|WP_Error
    184184 */
    185 function reset_password($key) {
     185function reset_password($key, $login) {
    186186    global $wpdb;
    187187
     
    191191        return new WP_Error('invalid_key', __('Invalid key'));
    192192
    193     $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s", $key));
     193    if ( empty($login) || !is_string($login) )
     194        return new WP_Error('invalid_key', __('Invalid key'));
     195
     196    $user = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login));
    194197    if ( empty( $user ) )
    195198        return new WP_Error('invalid_key', __('Invalid key'));
     
    371374case 'resetpass' :
    372375case 'rp' :
    373     $errors = reset_password($_GET['key']);
     376    $errors = reset_password($_GET['key'], $_GET['login']);
    374377
    375378    if ( ! is_wp_error($errors) ) {
Note: See TracChangeset for help on using the changeset viewer.