I’m transferring 10K users from Drupal 7 to Drupal 8. I want to retain passwords. What I’m trying is
- dump user records from Drupal 7 as a CSV file
- dump hashed passwords from MySQL as a CSV file
- load user records and hashed passwords into a custom program
- in the program, add hashed passwords to the correct user records (match by UID)
- manipulate user records (consolidate duplicates, combine fields, and more)
- output fixed-up user records (including password hash) to a CSV file
- use this CSV file as input to a custom Drupal 8 module to create users
All of this is easy EXCEPT creating users in Drupal 8 with their Drupal 7 passwords.
I have tried simply
$values = array [ 'name' => 'test', 'mail' => 'email@example.com', 'roles' => , 'pass' => $hashed_drupal_7_password, 'status' => 1, ]; $account = entity_create('user', $values); $account->save();
but of course Drupal 8 assumes the
pass value is the textual password and rehashes it.
QUESTION: Is there a way to get the already-hashed password into the user account, either during creation or after it is created? If I get them in, will they still work? As you can tell by reading, I’m a neophyte when it comes to passwords, encryption, etc. I’ve read many posts and articles, but don’t recognize an answer to this question.