I have build a plugin on the
authenticate() method in
It is working and I can change the firstname of something else of the customer.
I'm trying to find the password in an other system, and set that password to the customer on the moment of login. Everything works, and I get the information.
The only problem is saving the password to Magento2.
$customer = $this->customerRepository->getById($customerId); $customerSecure = $this->customerRegistry->retrieveSecureData($customer->getId()); $customerSecure->setPasswordHash($this->encryptor->getHash($password, true)); $this->customerRepository->save($customer);
$customer = $this->customerFactory->create(); $customer->load($_customer->getId()); $customer->setPassword($password); $customer->save();
None of them seems to resetting / setting my password.
And ideas how to fix it ?