Make WordPress Core

Ticket #27192: 27192.1.diff

File 27192.1.diff, 2.2 KB (added by ericlewis, 11 years ago)
  • wp-includes/ms-functions.php

     
    14681468
    14691469You can log in to the administrator account with the following information:
    14701470Username: USERNAME
    1471 Password: PASSWORD
    1472 Log in here: BLOG_URLwp-login.php
     1471Set your password and log in here: PW_SET_URL
    14731472
    14741473We hope you enjoy your new site. Thanks!
    14751474
     
    14831482        $welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email );
    14841483        $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
    14851484        $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
     1485        $welcome_email = str_replace( 'PW_SET_URL', get_user_reset_password_url( $user->ID ), $welcome_email );
    14861486
    14871487        /**
    14881488         * Filter the content of the welcome email after site activation.
  • wp-includes/user.php

     
    19971997
    19981998        return $user_id;
    19991999}
     2000
     2001/**
     2002 * Get the URL for the reset password screen.
     2003 *
     2004 * @param  int    $user_id
     2005 * @return string URL
     2006 */
     2007function get_user_reset_password_url( $user_id ) {
     2008        global $wpdb;
     2009
     2010        $user = get_userdata( $user_id );
     2011
     2012        // Generate something random for a password reset key.
     2013        $key = wp_generate_password( 20, false );
     2014
     2015        /**
     2016         * Fires when a password reset key is generated.
     2017         *
     2018         * @since 2.5.0
     2019         *
     2020         * @param string $user_login The username for the user.
     2021         * @param string $key        The generated password reset key.
     2022         */
     2023        do_action( 'retrieve_password_key', $user->user_login, $key );
     2024
     2025        // Now insert the key, hashed, into the DB.
     2026        if ( empty( $wp_hasher ) ) {
     2027                require_once ABSPATH . 'wp-includes/class-phpass.php';
     2028                $wp_hasher = new PasswordHash( 8, true );
     2029        }
     2030        $hashed = $wp_hasher->HashPassword( $key );
     2031        $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
     2032
     2033        return network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login');
     2034}
     2035 No newline at end of file