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

bander2 - June 17, 2009 - 01:10

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

Liliplanet - June 19, 2009 - 11:07

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

RAFA3L - July 7, 2009 - 06:22

same here

#4

stoichyu - July 15, 2009 - 17:48
Status:active» needs review

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

beday00 - August 5, 2009 - 02:28
Status:needs review» reviewed & tested by the community

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?

AttachmentSize
password_reset.patch 575 bytes

#6

csilver - August 13, 2009 - 23:09

any eta when this will be commited?

#7

Robert Castelo - August 13, 2009 - 23:33

Totally swamped at the moment. Will try and review this next week.

#8

Robert Castelo - September 20, 2009 - 19:28
Status:reviewed & tested by the community» fixed

Fixed in 5.x-2.10 and 6.x-2.2 - thanks for the patch and testing.

#9

System Message - October 4, 2009 - 19:30
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.