Skip to content

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

Closed
wants to merge 7 commits into from
Closed

Fixed the customer rp token invalid issue. #28704

wants to merge 7 commits into from

Conversation

sagar2009kumar
Copy link
Contributor

@sagar2009kumar sagar2009kumar commented Jun 12, 2020

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:

  1. resolves [Issue] Fixed the customer rp token invalid issue. #29663: Fixed the customer rp token invalid issue.

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.
@m2-assistant
Copy link

m2-assistant bot commented Jun 12, 2020

Hi @sagar2009kumar. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

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.

@rogyar rogyar self-assigned this Jun 14, 2020
@rogyar rogyar added the Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests label Jun 14, 2020
@rogyar
Copy link
Contributor

rogyar commented Jun 14, 2020

@magento run all tests

@sagar2009kumar
Copy link
Contributor Author

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

@rogyar
Copy link
Contributor

rogyar commented Jun 16, 2020

@magento run all tests

@rogyar
Copy link
Contributor

rogyar commented Jun 20, 2020

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!

@sagar2009kumar
Copy link
Contributor Author

HI @rogyar , I will create the unit test for this class and let you know when done. Thanks for the guidance.

@sidolov sidolov added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. labels Aug 18, 2020
@sidolov
Copy link
Contributor

sidolov commented Aug 18, 2020

@magento create issue

@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-8036 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@sagar2009kumar thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@engcom-Charlie engcom-Charlie self-assigned this Aug 20, 2020
@engcom-Charlie
Copy link
Contributor

@magento run all tests

@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-8036 has been created to process this Pull Request

@engcom-Alfa engcom-Alfa self-assigned this Sep 4, 2020
@engcom-Alfa engcom-Alfa added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests and removed Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests labels Sep 4, 2020
@engcom-Alfa
Copy link
Contributor

Hi @sagar2009kumar. Thank you for your contribution!

The problem has already been fixed by PR #27269 .
So, we have to close it.

Thanks!

@engcom-Alfa engcom-Alfa closed this Sep 4, 2020
@m2-assistant
Copy link

m2-assistant bot commented Sep 4, 2020

Hi @sagar2009kumar, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: test coverage Component: Customer Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: testing in progress Release Line: 2.4 Severity: S2 Major restrictions or short-term circumventions are required until a fix is available.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Issue] Fixed the customer rp token invalid issue.
6 participants