We are migrationgmigrating our old site from core phpplain PHP to drupalDrupal 8. Passwords are encryptedhashed with md5MD5 in the old site and wantsite; I need to migrate them as SHA algorithmin Drupal.
I tried belowthe following code, but thisit takes md5the password as simpleplain text password and convert them ascalculates its SHA hash.
public function prepareRow(Row $row) {
$password = $row->getSourceProperty('user_password');
$hash = \Drupal::service('password')->hash($password);
$row->setSourceProperty('user_password', $hash);
}
This is my configthe configuration file:.
id: users
label: User migration
migration_group: mymodule_general_migration_groups
source:
plugin: mymodule_migration_users
process:
pass: user_password
mail: user_email
init: user_email
status:
plugin: default_value
default_value: 1
name:
plugin: dedupe_entity
source: username
entity_type: user
field: name
postfix: _
created:
plugin: callback
source: created
callable: strtotime
changed: user_regdate
access: user_regdate
login: user_lastvisit
destination:
plugin: entity:user
md5_password: true
migration_dependencies: {}
dependencies:
enforced:
module:
- mymodule_migration