gostbuster Posted October 12, 2014 Share Posted October 12, 2014 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 More sharing options...
cristic Posted October 13, 2014 Share Posted October 13, 2014 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 More sharing options...
vekia Posted October 13, 2014 Share Posted October 13, 2014 password is updated with: $this->customer->update() this function updates object information in database in this case customer is an object Link to comment Share on other sites More sharing options...
gostbuster Posted October 13, 2014 Author Share Posted October 13, 2014 Ho thanks, I see know, this happens exactly here (in objectModel class, line 1056 : if ($field == 'passwd') { if ($value = Tools::getValue($field)) $this->{$field} = Tools::encrypt($value); } Thanks so much Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now