Jump to content

Programmatically change customer password


iulianba

Recommended Posts

I am trying to programmatically change customer password. Everything goes well until I update the customers table with the new password.

Once I do that, I get logged out and redirected to login. 

I have a method to redirect the user in other place, but it never gets there, since the user gets logged out.

Is there a way to achieve this?

Db::getInstance()->update('customer',
	[
		'passwd' => $crypto->hash($new_password)
	],
	'id_customer = '.(int)$this->context->customer->id.''
);

Tools::redirect($this->context->link->getModuleLink('my-module', 'change-password'));

Thanks

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