I've got the weirdest problem I've ever come across, I'm not brilliant with class based systems so maybe its not magento related...

So the basics are that the reset password function isn't working. I've narrowed it down to $customer not being received from a function that is definitely returning it.

resetPassword() in \vendor\magento\module-customer\Model\AccountManagement.php

gets the $customer from

get() in \vendor\magento\module-customer\Model\ResourceModel\CustomerRepository.php 

which gets the $customer from retrieveByEmail() in


so retrieveByEmail() definitely gets the customer, but get() doesn't ever receive it.

I've tested it by swapping retrieveByEmail() to just retrieve() with a single customerID and it works ( up to the next problem which is save($customer) but thats for another day.

I just can't figure out why retrieveByEmail() returns a $customer object but get() doesn't receive it?

any ideas?

edit thanks @Kristoffer, I have checked the storeID is the correct store and retrieveByEmail is sending back the same customerID 67 that I tested with retrieve(67).

I can't see how or why get() isn't receiving the customer that retrieveByEmail is sending, but it is receiving that from retrieve()

2 Answers 2


My guess is that the customer you are trying to load by email is not a customer at the website your are running as.

If you check the code for retrieveByEmail it has:


if ($websiteId === null) {
        $websiteId = $this->storeManager->getStore()->getWebsiteId()
                ?: $this->storeManager->getDefaultStoreView()->getWebsiteId();

Just as a test here you can change this code and set $websiteId = the website id you know that the customer is a customer of and see if it loads correct.

In Magento admin a customer can be set either to global scope or website scope. If set to website scope a single email can have different customer ids in Magento for every website.



there was a custom plugin intercepting the process but not returning the result

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.