I am able to migrate all the datas of users account including the password but it doesn’t work due to encryption and hash in drupal 8.
My password are not MD5. They are not encrypted, in csv file they are like normal plain text.
I’ve seen here : https://www.drupal.org/docs/8/api/migrate-api/migrate-destination-entityuser
If the incoming passwords are not plain or are not MD5 hashed you’ll have to deal with this in your migration
My password are plain so i guess it should work.
Here is what i’ve tried but the password are imported but not encrypted :
destination: plugin: 'entity:user' plaintext_passwords: true
In the documentation, it is explained how to import MD5 password but not plain password.
What should i use for the configuration ?
EDIT :
I’ve tried this :
pass: - plugin: callback callable: 'Drupal\Core\Password\PhpassHashedPassword::hash' source: passwebservice
And
pass: - plugin: callback callable: - 'Drupal\Core\Password\PhpassHashedPassword' - hash source: passwebservice
Error :
Error: Using $ this when not in object context in Drupal\Core\Password\PhpassHashedPassword::hash() [error] (line 215 of Core/Password/PhpassHashedPassword.php) 0 [internal function]: Drupal\Core\Password\PhpassHashedPassword::hash(‘9BQmM1’) 1 core/modules/migrate/src/Plugin/migrate/process/Callback.php(54): call_user_func(‘Drupal\Core\Pas…’, ‘9BQmM1’)
When i check hash()
public function hash($ password) { return $ this->crypt('sha512', $ password, $ this->generateSalt()); }
I can’t invoke method this way ($ this
does not exist in class context) so how can I do ? Is it possible in configuration file ?