Make WordPress Core

Ticket #5837: 5837.patch

File 5837.patch, 2.7 KB (added by pishmishy, 16 years ago)

Generates random passwords for users created by import

  • wp-admin/import/mt.php

     
    6161        function checkauthor($author) {
    6262                global $wpdb;
    6363                //mtnames is an array with the names in the mt import file
    64                 $pass = 'changeme';
     64                $pass = wp_generate_password();
    6565                if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
    6666                        ++ $this->j;
    6767                        $this->mtnames[$this->j] = $author; //add that new mt author name to an array
     
    153153<h2><?php _e('Assign Authors'); ?></h2>
    154154<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as admin\'s entries.'); ?></p>
    155155<p><?php _e('Below, you can see the names of the authors of the MovableType posts in <i>italics</i>. For each of these names, you can either pick an author in your WordPress installation from the menu, or enter a name for the author in the textbox.'); ?></p>
    156 <p><?php _e('If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)'); ?></p>
     156<p><?php _e("If a new user is created by WordPress, a password will be randomly generated. Manually change the user's details if necessary."); ?></p>
    157157        <?php
    158158
    159159
  • wp-admin/import/wordpress.php

     
    161161
    162162                                $user_id = username_exists($new_author_name);
    163163                                if ( !$user_id ) {
    164                                         $user_id = wp_create_user($new_author_name, 'changeme');
     164                                        $user_id = wp_create_user($new_author_name, wp_generate_password());
    165165                                }
    166166
    167167                                $this->author_ids[$in_author_name] = $user_id;
     
    181181<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
    182182<?php
    183183        if ( $this->allow_create_users() ) {
    184                 echo '<p>'.__('If a new user is created by WordPress, the password will be set, by default, to "changeme". Quite suggestive, eh? ;)')."</p>\n";
     184                echo '<p>'.__("If a new user is created by WordPress, a password will be randomly generated. Manually change the user's details if necessary.")."</p>\n";
    185185        }
    186186
    187187
     
    742742
    743743register_importer('wordpress', 'WordPress', __('Import <strong>posts, comments, custom fields, pages, and categories</strong> from a WordPress export file'), array ($wp_import, 'dispatch'));
    744744
    745 ?>
    746  No newline at end of file
     745?>