Skip to content
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

Add GraphQL mutations for Reset password for MyAccount #27876

Merged
merged 8 commits into from
May 18, 2020

Conversation

Usik2203
Copy link
Contributor

@Usik2203 Usik2203 commented Apr 16, 2020

Description (*)

Related Pull Requests

Fixed Issues (if relevant)

Customer :: MyAccount :: Reset password for MyAccount

Manual testing scenarios (*)

  1. ...
  2. ...

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Apr 16, 2020

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

For more details, please, review the Magento Contributor Guide documentation.

@magento-engcom-team magento-engcom-team added Component: CustomerGraphQl Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Apr 16, 2020
@Usik2203 Usik2203 added the WIP Work In Progress label Apr 16, 2020
@Usik2203 Usik2203 marked this pull request as draft April 16, 2020 15:15
@Usik2203 Usik2203 changed the title Feature 259 Add GraphQL mutations for Reset password for MyAccount [WIP]Feature 259 Add GraphQL mutations for Reset password for MyAccount Apr 16, 2020
@Usik2203 Usik2203 requested a review from rogyar April 16, 2020 15:16
@rogyar rogyar self-assigned this Apr 16, 2020
Copy link
Contributor

@rogyar rogyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Usik2203. Good job. Please, check my comments below.

/**
* @var AccountManagementInterface
*/
protected $customerAccountManagement;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use the private scope for properties that are not supposed to be inherited.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also applies to all other cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

$args['email'],
AccountManagement::EMAIL_RESET
);
} catch (\Exception $e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious. Is there some unhandled exception in the flow? If it is so, we should not simply return false but throw LocalizedException instead.

But the main question is, do we have an unhandled exception somewhere in the middle?

Copy link
Contributor Author

@Usik2203 Usik2203 Apr 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added LocalizedException .
Yes, we have exceptions inside $this->customerAccountManagement->resetPassword() and $this->customerAccountManagement->initiatePasswordReset() these exceptions related with

  1. Checks if customer account is for this email
  2. Checks match token
  3. Checks length of password

$args['newPassword']
);
} catch (\Exception $e) {
return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, read my notice about catching the exception above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

/**
* @expectedException \Exception
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do not use exception annotations like expectedException and expectedExceptionMessage. This approach is deprecated in PHPUnit. Feel free to use the corresponding methods instead (self::expectException, self::expectExceptionMessage)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@rogyar
Copy link
Contributor

rogyar commented Apr 21, 2020

Also, may a ask you to squash all your commit into a single one and perform the force-push to this branch, please?

Thank you

@rogyar rogyar added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: test coverage Award: category of expertise labels Apr 21, 2020
@Usik2203
Copy link
Contributor Author

Hi @rogyar
I have applied your recomendation about squashing commits.
Thank you.

@rogyar rogyar changed the title [WIP]Feature 259 Add GraphQL mutations for Reset password for MyAccount Feature 259 Add GraphQL mutations for Reset password for MyAccount Apr 23, 2020
@rogyar rogyar marked this pull request as ready for review April 23, 2020 08:52
@lenaorobei
Copy link
Contributor

@magento run WebAPI Tests

@magento-engcom-team
Copy link
Contributor

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

@slavvka slavvka merged commit 14db001 into magento:2.4.0-develop May 18, 2020
@m2-assistant
Copy link

m2-assistant bot commented May 18, 2020

Hi @Usik2203, 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.

@nrkapoor nrkapoor linked an issue Jun 9, 2020 that may be closed by this pull request
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: category of expertise Award: test coverage Component: CustomerGraphQl Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: accept Project: GraphQL Release Line: 2.4 Severity: S1 Affects critical data or functionality and forces users to employ a workaround.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customer :: MyAccount :: Reset password for MyAccount