0

After upgrading from Magento 2.3.4 to 2.4.3-p3, when I ask Magento to send the "Forgot password" email, I get instead of the expected template: Malformed UTF-8 characters, possibly incorrectly encoded.

After investigations, I observed that the rp_token retrieved in the method : \Magento\Customer\Model\CustomerRegistry::retrieveSecureData does not look like what was generated here: vendor/magento/module-customer/Model/AccountManagement.php:666 but more like a string of badly encoded characters.

example:

getUniqueHash generated: kVbfH1PAMkAs1drINkJ60zoy8yBHh5aw

Returned from retrieveSecureData method : .�Q��p~U%��<�A�D���H�6�

Despite my research I have not been able to find a valid solution. Has anyone encountered or seen a similar problem?

10
  • I think that isn't mate, because after magento update rpToken after get response from retrieveSecureData
    – HoangHieu
    Nov 28, 2022 at 15:35
  • When Magento saves the token, it is the one generated previously but, after saving, Magento will re-fetch the customer's information from the database and it is at the time of this retrieval that it is not decrypted correctly and returns me .�Q��p~U%��<�A�D���H�6�
    – Kallard
    Nov 28, 2022 at 15:44
  • after reading the code, I confusing now, How can they save the token :(
    – HoangHieu
    Nov 28, 2022 at 15:53
  • I think this is similar your issue github.com/magento/magento2/issues/35663
    – HoangHieu
    Nov 28, 2022 at 15:58
  • Yup, but I try this solution not working because I encrypt my encrypted string
    – Kallard
    Nov 28, 2022 at 16:03

1 Answer 1

0

I tried with a blank magento 2.4.3-p3 and understood and solved my problem.

The encrypted rp_token is added in the customer_entity table AND the old (maybe) unencrypted token was stored in customer_entity_varchar.

When Magento retrieved the customer data, it found an encrypted token BUT, when it retrieved in the same action the model attributes in MagentoEav\ModelEntity\AbstractEntity::_loadModelAttributes on line 1062, Magento found the unencrypted token in the customer_entity_varchar table which caused problems because it was trying to decrypt a cleartext value which caused my problem.

To fix this problem, I removed the rp_token from the customer_entity_varchar table and it works again. I did the test by creating a dummy token and performed the password reset request action again and I was getting the error again.

Thank you @HoangHieu for the time you spent to help me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.