Magento2: Password Reset fails with "unable to send the password reset email" due to failing customer model validation

Created on 12 Sep 2016  路  20Comments  路  Source: magento/magento2

Preconditions

  1. 2.1.1
  2. 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

  3. try to reset password in the frontend

    Expected result

  4. password reset link is sent

    Actual result

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

Customer WroCD Confirmed P1 ready for dev Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x S1 bug report

Most helpful comment

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.

All 20 comments

This doesn't looks like bug but a feature actually. How can customer update attributes if he forgot password?

I'm not sure sure I follow - the customer has no chance to update his account and add the missing data himself when he's not able to recover his lost password: not getting the password recovery email prevents him from fixing the missing data. and not being able to fix the missing data will prevent him from getting the recovery email...

it seems the phone number was not mandatory in magento 1 customer adresses, but is now mandatory - it is not even configurable through eav_attribute but now has a hardcoded check in the customer address validation. around 11'000 customers out of ~80'000 customers we migrated to magento 2 are missing this field data. those among them that forgot their password are now locked out and will have to contact customer support - if they even bother.

@ilol Illia--please check this scenario via data migration tool. I believe the comment is correct that this was not a required field in M1 but default but certainly could be made to be not required. If the field is set to required in M2 then this scenario will occur

@heldchen

it seems the phone number was not mandatory in magento 1 customer adresses

It is required by default in Magento 1 CE/EE. But it can be changed manually to not required. I assume that is what had happened. The customer had his reasons to do this and why in Magento 2 the attribute is hardcoded as required stays controversial as for me

1691 - the same issue and that issue is registered MAGETWO-58099

is there still information needed from me or can the needs update label be removed?

any one have solution for this issue ? I am also facing same issue forgot password not working.
"We're unable to send the password reset email."

@heldchen, thank you for your report.
We've created internal ticket(s) MAGETWO-81350 to track progress on the issue.

More than a year this error reported and still no solution ... we use M2.1.8 and still face this error. Please do something..

2.1.8 here and having same issue. Unreal basic functionality is still not fixed to this point in M2

Same issue on 2.2.1

I fixed the issue but I don't know about if its create any issue in the future or not?

Just open the database, find the customer_sublogin table and go to the structure of the table

Here, you can see that the Email field, that is not null, just make it like it accepts the Null values.

Then try with forgot password

We are running EE 2.2.3 and have this problem with Customer Attributes. All password reset options both by the user and on the Admin interface are blocked by required fields. On the Admin side there is a message, "XXXXXX is a required field" when a password reset is attempted. On the user side we get the message, "Unable to send the password reset email."

@pstav123
Meanwhile you can patch your magento with my solution #15304 or eventually, by reading pull request, develop your own solution basing on recognized source of an issue.

More than two year this error reported and still no solution ... we use M2.3.0 and still face this error. Please do something..

@ndslindia

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.

Hi @engcom-Bravo. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


Hello @heldchen
We can't reproduce this issue on Magento 2.4 develop
We are performing the following steps:

  1. From Admin _Stores - Configuration - Customer - Customer Configuration - Name and Addresses Options_ set Show Telephone to No
    telephone_no
  2. From the Store Front, Create an Account, please note that there is no Telephone field when creating a new account
    create_new_customer
  3. Sign In with the newly Created Account
    Go to _Address Book_ and fille in the required info, please note that the Phone field is missing
    adress
  4. Sign Out from Store Front, and go to Admin _Stores - Configuration - Customer - Customer Configuration - Name and Addresses Options_ Set Show Telephone to Required. Save Config
    required
  5. Go to Store Front, click _Sign In - Forgot Your Password_
    forgot
  6. Follow all the steps to recover your Password...
  7. Check the received e-mail
    AR: The link from the received e-mail leads to correct _Set a New Password_ page.
    set a new password
    Password is changed Successfully
    updated pass

Please, verify if the issue is still reproducible on Magento 2.4- develop.
If yes, please, provide more detailed steps to reproduce.

_Thank you,
Magento engcom_

Please feel free to comment, reopen or create new ticket according to the Issue reporting guidelines
if you are still facing this issue on the latest 2.4-develop branch. Thank you for collaboration.

appreciate you looking into this, but: this issue was reported in 2016 and confirmed several times in the past, so for sure I won't waste anymore of my time on this.

Was this page helpful?
0 / 5 - 0 ratings