-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fixed the customer rp token invalid issue. #28704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
When the token got expired and it is hit through the api. Then since there is no throw statement it does not throw exception rather it goes down below to the line $found->getItems()[0] giving the null because there is no such token and the error has not been thrown, it is just being created. Since this function returns the CustomerInterface it is giving off the 500 internal server error "Fatal Error: 'Uncaught TypeError: Return value of Magento\\Customer\\Model\\ForgotPasswordToken\\GetCustomerByToken::execute() must implement interface Magento\\Customer\\Api\\Data\\CustomerInterface, null".
Fixed the customer token expired issue when there is no such token.
Hi @sagar2009kumar. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. |
@magento run all tests |
@rogyar All the checks has been run by the magento and it was showing 14/14 checks successful. But then there was the option of update branch and i click that and then all the checks status has been changed to Expected (required). Do i need to do something from my side ? I have not contributed to magento before, so i don't know the process. Please guide me. |
@magento run all tests |
Hi @sagar2009kumar. Thank you for your collaboration. According to the definition of done all changes should be covered by automated tests. In this particular case I would recommend creating a unit test that will check if the exception is thrown if total tokens count is zero. Feel free to cover other cases of this class as well if you wish. Thank you! |
HI @rogyar , I will create the unit test for this class and let you know when done. Thanks for the guidance. |
@magento create issue |
Hi @sidolov, thank you for the review. |
@sagar2009kumar thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
@magento run all tests |
Hi @rogyar, thank you for the review. |
Hi @sagar2009kumar. Thank you for your contribution! The problem has already been fixed by PR #27269 . Thanks! |
Hi @sagar2009kumar, thank you for your contribution! |
Steps To reproduce :
Step 1 : Hit the api for getting the customer rp token.
Setp 2 : Use the rp token.
Step 3 : Again use that rp token for resetting password, in this case 500 server error is get instead of no such rp token.
Explanation.
When the token got expired and it is hit through the api. Then since there is no throw statement it does not throw exception rather it goes down below to the line $found->getItems()[0] giving the null because there is no such token and the error has not been thrown, it is just created. Since this function returns the CustomerInterface due to type casting it is giving off the 500 internal server error "Fatal Error: 'Uncaught TypeError: Return value of Magento\Customer\Model\ForgotPasswordToken\GetCustomerByToken::execute() must implement interface Magento\Customer\Api\Data\CustomerInterface, null".
Resolved issues: