Password being reset on re-import
csilver - June 15, 2009 - 19:19
| Project: | User Import |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
I maintain my userlist in another application, whichi exports to a CSV file that is used for user_import. This mostly works, but there are a few problems. Most important is that when I import (to pickup new users, changes in profile information, etc.), all passwords are reset. So existing users can't login anymore.
Is this by design? Is there anyway to prevent this so users can continue to use the website?

#1
I am getting this problem too. I am looking though the code and it is a little over my head, but it seems there is a safegaurd against creating a username if one already exists, but not a similar safeguard for passwords.
#2
Also have the same. If you select 'update existing users', passwords do not get imported, and does not write to the database.
Presume have to just delete double profiles by hand ..
#3
same here
#4
The problem lies in how drupal saves users, if it sees that the password value is set and the md5sum does not match with the original, it sets a new password. However, loading a user gets the password already md5-ed so loading a user and saving directly after would change the password.
In order to fix that, I modified the user_import/supported/user.inc in line 93-96:
<?php// update password
if ($update_setting_per_module['password'] == UPDATE_REPLACE) {
$account_add['pass'] = (empty($fields['user']['password'][0])) ? user_password() : $fields['user']['password'][0];
}
else {
$account_add['pass'] = "";
}
?>
That clears the password field in case we are not updating it so drupal doesn't change the password value.
#5
Here is a patch file for stoichyu's fix suggested in comment 4. It worked like a charm for me. Can we get this committed?
#6
any eta when this will be commited?
#7
Totally swamped at the moment. Will try and review this next week.
#8
Fixed in 5.x-2.10 and 6.x-2.2 - thanks for the patch and testing.
#9
Automatically closed -- issue fixed for 2 weeks with no activity.