magento2: Password Reset fails with "unable to send the password reset email" due to failing customer model validation
Preconditions
- 2.1.1
- customer with missing required data (f.e.
phone
is now required and has been optional at the time the user registered his account)
Steps to reproduce
- try to reset password in the frontend
Expected result
- password reset link is sent
Actual result
- message
We're unable to send the password reset email.
is shown
the real, underlying exception message is hidden, in our case, it was: "Phone" is a required value. "Phone" length must be equal or greater than 1 characters.
. as a fix, full field validation must be ignored during password resets.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (10 by maintainers)
This has nothing to do with the migration tool. ( Mad props to @victor-v-rad the tool is great ) This can happen easily without the context of a migration. Say one day your business changes and you decide to make the telephone field required as until now it was not. This is because Customer/AccountManagement::changeResetPasswordLinkToken uses Customer/CustomerRepository:save(). And there they coupled customer and address so tight that not even Tanos can break them. This also has a tremendous cost in performance. Each time a customer is saved via CustomerRepository:save() all his addresses get saved too, changes made to them or not. The customer(if honest) should never be prevented from recovering his password. I think this is just common sense.
@sevos1984 - I’m tagging you just to suffer the pain of reading the comment you left in 2016.
More than a year this error reported and still no solution … we use M2.1.8 and still face this error. Please do something…