Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

magento/devdocs#7366: GraphQL: Document password change mutations. Mutation: requestPasswordResetEmail. #7424

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/_data/toc/graphql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions src/guides/v2.4/graphql/mutations/request-password-reset-email.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
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. -->

When the customer clicks the `Set a New Password` button, Magento sends an email to the customer that contains a URL for resetting their password.

![Reset password email]({{ page.baseurl }}/graphql/images/reset-password-email.png)

The URL has the following format:

```text
https://<MAGENTOSITE>/customer/account/createPassword/?token=gh80pkjGdsPyiXc0sUUXswX1uGN7crUr
```

Use the value of the token in the `resetPassword` 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
}
}
```

## 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) -->