vinaysaini Posted October 3, 2013 Share Posted October 3, 2013 I wanted to update the password of current employee in back office. Here is my code what I did, $passwd_post = $_POST['passwd']; $passwd = Tools::encrypt($passwd_post); $eid = $this->context->employee->id; $this->updatePassword($passwd,$eid); /* update password function */ public function updatePassword($passwd,$eid) { $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' UPDATE '._DB_PREFIX_.'employee SET passwd = "'.$passwd.'" WHERE id_employee = "'.$eid.'"'); } This code works perfectly fine. But the problem is, Cookie has its own old password $this->context->employee->passwd Because of which as soon as I go to any other page it logs me out after the password has been changed. And I have to login again. How Can I fix this Any help?????? Link to comment Share on other sites More sharing options...
vekia Posted October 16, 2013 Share Posted October 16, 2013 you have to change employee password value stored in cookie take a look how it looks in authentication function: // Update cookie $cookie = Context::getContext()->cookie; $cookie->id_employee = $this->context->employee->id; $cookie->email = $this->context->employee->email; $cookie->profile = $this->context->employee->id_profile; $cookie->passwd = $this->context->employee->passwd; $cookie->remote_addr = $this->context->employee->remote_addr; $cookie->write(); 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