diff --git a/wp-login.php b/wp-login.php index c97edd938f..f1df02d374 100644 --- a/wp-login.php +++ b/wp-login.php @@ -115,6 +115,31 @@ function login_header($title = 'Log In', $message = '', $wp_error = '') { echo '

' . apply_filters('login_messages', $messages) . "

\n"; } } // End of login_header() + +/** + * Outputs the footer for the login page. + * + * @param string $input_id Which input to auto-focus + */ +function login_footer($input_id = '') { + echo "\n"; + + if ( !empty($input_id) ) { +?> + + +

+ + + +get_row($wpdb->prepare("SELECT * FROM $wpdb->users WHERE user_activation_key = %s AND user_login = %s", $key, $login)); + if ( empty( $user ) ) return new WP_Error('invalid_key', __('Invalid key')); + + return $user; +} - // Generate something random for a password... - $new_pass = wp_generate_password(); - +/** + * Handles resetting the user's password. + * + * @uses $wpdb WordPress Database object + * + * @param string $key Hash to validate sending user's password + */ +function reset_password($user, $new_pass) { do_action('password_reset', $user, $new_pass); wp_set_password($new_pass, $user->ID); - update_user_option($user->ID, 'default_password_nag', true, true); //Set up the Password change nag. - $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n"; - $message .= sprintf(__('Password: %s'), $new_pass) . "\r\n"; - $message .= site_url('wp-login.php', 'login') . "\r\n"; - - if ( is_multisite() ) - $blogname = $GLOBALS['current_site']->site_name; - else - // The blogname option is escaped with esc_html on the way into the database in sanitize_option - // we want to reverse this for the plain text arena of emails. - $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); - - $title = sprintf( __('[%s] Your new password'), $blogname ); - - $title = apply_filters('password_reset_title', $title); - $message = apply_filters('password_reset_message', $message, $new_pass); - - if ( $message && !wp_mail($user->user_email, $title, $message) ) - wp_die( __('The e-mail could not be sent.') . "
\n" . __('Possible reason: your host may have disabled the mail() function...') ); wp_password_change_notification($user); - - return true; } /** @@ -398,39 +413,60 @@ case 'retrievepassword' : - - -

- - - - ' . __('Your password has been reset.') . ' ' . __('Log in') . '

'); + login_footer(); + exit; + } + + login_header(__('Reset Password'), '

' . __('Reset your password') . '

', $errors ); +?> +
+

+ +

+

+ +

+
+

+
+ + + +" title="">

- - -

- - - -