WordPress.org

Make WordPress Core

Ticket #33209: 33209.diff

File 33209.diff, 2.1 KB (added by Ipstenu, 6 years ago)

Change default Multisite NOT to email passwords

  • wp-includes/ms-functions.php

     
    15811581         * @param string $password      User password.
    15821582         * @param array  $meta          Signup meta data.
    15831583         */
     1584
     1585        global $wpdb;
     1586
     1587        // Generate something random for a password reset key.
     1588        $key = wp_generate_password( 20, false );
     1589
     1590        do_action( 'retrieve_password_key', $user->user_login, $key );
     1591
     1592        // Now insert the key, hashed, into the DB.
     1593        if ( empty( $wp_hasher ) ) {
     1594                require_once ABSPATH . WPINC . '/class-phpass.php';
     1595                $wp_hasher = new PasswordHash( 8, true );
     1596        }
     1597        $hashed = time() . ':' . $wp_hasher->HashPassword( $key );
     1598        $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
     1599       
     1600        $resetlink = network_site_url( "wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login' );
     1601
    15841602        $welcome_email = apply_filters( 'update_welcome_user_email', $welcome_email, $user_id, $password, $meta );
    15851603        $welcome_email = str_replace( 'SITE_NAME', $current_site->site_name, $welcome_email );
    15861604        $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email );
    15871605        $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email );
    15881606        $welcome_email = str_replace( 'LOGINLINK', wp_login_url(), $welcome_email );
     1607        $welcome_email = str_replace( 'RESETLINK', $resetlink , $welcome_email );
    15891608
    15901609        $admin_email = get_site_option( 'admin_email' );
    15911610
     
    21362155        if ( !$text ) {
    21372156                remove_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
    21382157
    2139                 /* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, SITE_NAME: those are placeholders. */
     2158                /* translators: Do not translate USERNAME, PASSWORD, LOGINLINK, RESETLINK, SITE_NAME: those are placeholders. */
    21402159                $text = __( 'Howdy USERNAME,
    21412160
    21422161Your new account is set up.
    21432162
    2144 You can log in with the following information:
    21452163Username: USERNAME
    2146 Password: PASSWORD
    2147 LOGINLINK
    21482164
     2165To set your password, visit the following address:
     2166
     2167<RESETLINK>
     2168
    21492169Thanks!
    21502170
    21512171--The Team @ SITE_NAME' );