diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index 30c5b4759e8..677a264fd8d 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -213,6 +213,10 @@ pages: url: /graphql/mutations/reorder-items.html exclude_versions: ["2.3"] + - label: requestPasswordResetEmail mutation + url: /graphql/mutations/request-password-reset-email.html + exclude_versions: ["2.3"] + - label: revokeCustomerToken mutation url: /graphql/mutations/revoke-customer-token.html diff --git a/src/guides/v2.4/graphql/images/reset-password-email.png b/src/guides/v2.4/graphql/images/reset-password-email.png new file mode 100644 index 00000000000..9bc66ff8be5 Binary files /dev/null and b/src/guides/v2.4/graphql/images/reset-password-email.png differ diff --git a/src/guides/v2.4/graphql/mutations/request-password-reset-email.md b/src/guides/v2.4/graphql/mutations/request-password-reset-email.md new file mode 100644 index 00000000000..676f54e4666 --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/request-password-reset-email.md @@ -0,0 +1,72 @@ +--- +group: graphql +title: requestPasswordResetEmail mutation +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +The `requestPasswordResetEmail` mutation triggers the password reset email by the provided email address. Use it to initiate the process to reset the registered customer's password before calling the [resetPassword]({{page.baseurl}}/graphql/mutations/reset-password.html) mutation. + +## Syntax + +`mutation: {requestPasswordResetEmail(email: String!): Boolean}` + +## Example usage + +The following call triggers the password reset email. + +**Request:** + +```graphql +mutation { + requestPasswordResetEmail( + email: "roni_cost@example.com" + ) +} +``` + +**Response:** + +```json +{ + "data": { + "requestPasswordResetEmail": true + } +} +``` + +Customer will receive an email that contains a URL for resetting their password. + +![Reset password email]({{ page.baseurl }}/graphql/images/reset-password-email.png) + +Example of `Set a New Password` button reset URL: + +```text +https:///customer/account/createPassword/?token=gh80pkjGdsPyiXc0sUUXswX1uGN7crUr +``` + +## Input arguments + +You must specify the customer's email address in the `email` input argument. + +## Output attributes + +The `requestPasswordResetEmail` mutation returns `true` if both of the following operations are successful: + +- The reset password operation initiates. +- Magento sends an email containing a reset link. + +Otherwise, the mutation returns `false`. + +## Errors + +Error | Description +--- | --- +`Cannot reset the customer's password` | A general error message that appears on some internal system errors. The original error is logged and can be found in the Magento logs. +`The account is locked` | You cannot modify a locked customer account. +`The email address has an invalid format.` | The value provided in the `email` argument has an invalid format. +`You must specify an email address.` | An empty value is provided in the `email` argument. + +## Related topics + +- [resetPassword mutation]({{page.baseurl}}/graphql/mutations/reset-password.html)