Jump to content

Importing customer passwords from 1.4 to 1.5.4


DenisDenis
 Share

Recommended Posts

Hello everyone

 

I just started a new shop and I've imported all my customers from my old shop to the new one.

I copied the _COOKIE_KEY_ and _COOKIE_IV_ from the settings.inc.php from the old to the new but I still can't login with my own front end account. Is there something else that has to be copied over?

 

Kind regards

 

Denis

Share this post


Link to post
Share on other sites

Hello Denis. The key for encryption is on _COOKIE_KEY_ . Take a look at Tools.php, it uses explicity on this method:

public static function encrypt($passwd)
{
  return md5(_COOKIE_KEY_.$passwd);
}

 

As you should know, the password is stored encrypted. So you have made a right step copying the value from the old settings.inc.php to the new one. But I think maybe you haven't had into account that are some slight (but important) differences on the new table structure. This is a summary of the changes introduced from PS1.4.8 to 1.5.4 (PREFIX is related with your configuration, default is "ps"; this is only illustrative, don't run this script on your DB)

 

ALTER TABLE `PREFIX_customer`
  ADD `id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` ,
  ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`,
  ADD INDEX `id_shop_group` (`id_shop_group`),
  ADD INDEX `id_shop` (`id_shop`),
  ADD `id_lang` INT UNSIGNED NULL AFTER `id_default_group`;
UPDATE `PREFIX_customer` SET id_lang = (SELECT `value` FROM `PREFIX_configuration` WHERE name = 'PS_LANG_DEFAULT' LIMIT 1);
UPDATE `PREFIX_customer` c, `PREFIX_orders` o SET c.id_lang = o.id_lang WHERE c.id_customer = o.id_customer;

 

You must ensure that all the new columns has the proper value. Could you check this out? I'm willing to help you, so I hope this would be helpful for you. If this is ok and you still cannot access properly with your old password, then I could guide you to do some debug tasks. ;) Don't worry, your problem will be solved.

 

Best Regards,

 

 

Axel

------------------

Check this cool modules (must have) :

LoginAsCustomer for PS1.5

Cart Details

MultiTabsForProducts

Edited by axelmdp (see edit history)

Share this post


Link to post
Share on other sites

I'm sorry for not getting back to this topic, I think I found the solution.

 

Everything was copied over correctly, I found the problem was in the way the import works.

Apparently prestashop encrypts the passwords when they get imported, but because they were exported already encrypted this was not necessary. I took the encrypting part out of the code in this file: controllers/admin/AdminImportController.php file.

I changed

 

 

if ($customer->passwd)

$customer->passwd = Tools::encrypt($customer->passwd);

 

to

 

 

if ($customer->passwd)

$customer->passwd = $customer->passwd;

I hope this helps someone else out with the same problem!

Thank you for your time axel!

  • Like 2

Share this post


Link to post
Share on other sites

Great Denis! I'm glad you've found the solution. :)

 

BTW,when you said "imported" on your first post, I had thought you meant that you had made a DB sql script for table export/import, and that was the way through I had guided you; that's why I did that suggestion.

 

Have a nice day! Regards,

 

Axel

------------------

Check this cool modules (must have) :

LoginAsCustomer for PS1.5

Cart Details

MultiTabsForProducts

Edited by axelmdp (see edit history)

Share this post


Link to post
Share on other sites

  • 1 year later...
I changed


if ($customer->passwd)
$customer->passwd = Tools::encrypt($customer->passwd);

to 


if ($customer->passwd)
$customer->passwd = $customer->passwd;

Hi, 

looks like this does not work in 1.5.6.2. After code change, data are not imported (with no error code. Only exactly same success message will appear like when import is successfuly completed.

I also tried to comment it out but that does not work either. 

Edited by watheris (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More