Jump to content

how customer password is updated


gostbuster

Recommended Posts

Hi all,

 

I'm still digging in the source code, and there is something I can't understand.

 

This is about updating the customer's password.

 

I know that is happen in the identity controller (index.php?controller=identity)

 

And when I read he IdentityController.php source code, I have :

 

elseif (!Tools::getIsset('old_passwd') || (Tools::encrypt($old_passwd) != $this->context->cookie->passwd))
$this->errors[] = Tools::displayError('The password you entered is incorrect.');
elseif (Tools::getValue('passwd') != Tools::getValue('confirmation'))
$this->errors[] = Tools::displayError('The password and confirmation do not match.');
Well, ok, I see that are the password verification, but then I don't see explicitally where the password is updated.

 

 

what I see is :

 

	if (Tools::getValue('passwd'))
					$this->context->cookie->passwd = $this->customer->passwd;
				if ($this->customer->update())
Well the cookie is updated but I don't see the $this->customer->passwd updated..

 

Which part of code am I missing ?

 

Thanks in advance,

 

Regards

Link to comment
Share on other sites

Well, this part is done in customer->validateController():

	// Merge all errors of this file and of the Object Model
	$this->errors = array_merge($this->errors, $this->customer->validateController());

You don't see an explicit customer->passwd because this is taken from the $_POST array based on fields definition of Customer object.

 

It is always a good idea to use ppp or ddd PS functions to see the exact values:

	ppp($this->customer);
	// Merge all errors of this file and of the Object Model
	$this->errors = array_merge($this->errors, $this->customer->validateController());
	ddd($this->customer);

ppp is just to print_r the object and ddd to stop the code (die).

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...