Jump to content

Moving site to new hosting customer passwords retrieving


Recommended Posts

Hi all developers, i need help from someone with one specific reason.

 

SHORT INFO:

1) My client has prestashop site which is still working with default prestashop theme and features and about 500 customers.

2) I created new site using Prestashop 1.4.3.

 

PROBLEM:

 

I need to move customers data to the new site, which is on different hosting.

1) I Analyzed differenceses beetween TABLE STRUCTURES. And successfully copied tables: customer, customer_groups and address.

2) Yeah i know that different prestashop installation has unique _COOKIE_KEY_ which is used for user password generations, but i don't have the old site _COOKIE_KEY_.

 

So i was thinking to inform users with a message on pressing remind password link.

But then i am getting email, and press the link to send new password. i get error:

 

An error occurred with your account and your new password cannot be sent to your e-mail. Please report your problem using the contact form.

 

So any ideas? How to fix it?

 

I discovered that errors occurs on file PasswordController.php

 

elseif (($token = Tools::getValue('token')) && ($id_customer = (int)(Tools::getValue('id_customer'))))
 {
  $email = Db::getInstance()->getValue('SELECT `email` FROM '._DB_PREFIX_.'customer c WHERE c.`secure_key` = "'.pSQL($token).'" AND c.id_customer='.(int)($id_customer));
  if ($email)
  {
$customer = new Customer();
$customer->getByemail($email);
if ((strtotime($customer->last_passwd_gen.'+'.(int)($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')).' minutes') - time()) > 0)
 Tools::redirect('authentication.php?error_regen_pwd');
else
{
 $customer->passwd = Tools::encrypt($password = Tools::passwdGen((int)(MIN_PASSWD_LENGTH)));

 $customer->last_passwd_gen = date('Y-m-d H:i:s', time());
	  print_r($customer);
 if ($customer->update())
 {
  if (Mail::Send((int)(self::$cookie->id_lang), 'password', Mail::l('Your password'),
  array('{email}' => $customer->email,
	 '{lastname}' => $customer->lastname,
	 '{firstname}' => $customer->firstname,
	 '{passwd}' => $password),
  $customer->email,
  $customer->firstname.' '.$customer->lastname))
   self::$smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
  else
   $this->errors[] = Tools::displayError('Error occurred when sending the e-mail.');
 }
 else
  $this->errors[] = Tools::displayError('An error occurred with your account and your new password cannot be sent to your e-mail. Please report your problem using the contact form.');
}
  }
  else
$this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
 }

 

Where method $customer->update() returns false.

 

So anyone can help me maybe on fixing this issue?

Link to comment
Share on other sites

  • 3 months later...
  • 6 months later...

Hi Benjamin,

 

I actually do have it, but where should i look for it exactly?

 

EDITED:

I think I've found the cookie key - while I've moved my shop with the same database from one domain to other only, but left at the same host, the cookie-key in the settings.inc.php file are the same. Seems that the problem is elsewhere...

 

EDITED again:

 

I found that the problem was not with the database, but with email templates, because english language worked perfectly, while other language mail templates were using different code - I've copied the code

<a href="{url}">{url}</a>

from the English template to other languages and now it works fine!

Edited by sting5 (see edit history)
Link to comment
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
×
×
  • Create New...