diff --git a/src/_data/toc/graphql.yml b/src/_data/toc/graphql.yml index 677a264fd8d..e24df6653b7 100644 --- a/src/_data/toc/graphql.yml +++ b/src/_data/toc/graphql.yml @@ -220,6 +220,10 @@ pages: - label: revokeCustomerToken mutation url: /graphql/mutations/revoke-customer-token.html + - label: resetPassword mutation + url: /graphql/mutations/reset-password.html + exclude_versions: ["2.3"] + - label: sendEmailToFriend mutation url: /graphql/mutations/send-email-to-friend.html 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 index b55d0872055..67af3eb88d4 100644 --- a/src/guides/v2.4/graphql/mutations/request-password-reset-email.md +++ b/src/guides/v2.4/graphql/mutations/request-password-reset-email.md @@ -5,8 +5,7 @@ contributor_name: Atwix contributor_link: https://www.atwix.com/ --- -The `requestPasswordResetEmail` mutation triggers the password reset email by the provided email address. - +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. @@ -72,4 +71,4 @@ Error | Description ## Related topics - +[resetPassword mutation]({{page.baseurl}}/graphql/mutations/reset-password.html) diff --git a/src/guides/v2.4/graphql/mutations/reset-password.md b/src/guides/v2.4/graphql/mutations/reset-password.md new file mode 100644 index 00000000000..b3d6c693407 --- /dev/null +++ b/src/guides/v2.4/graphql/mutations/reset-password.md @@ -0,0 +1,70 @@ +--- +group: graphql +title: resetPassword mutation +contributor_name: Atwix +contributor_link: https://www.atwix.com/ +--- + +The `resetPassword` mutation resets customer password using a reset password token and the customer's email address. Use it to set a new password for the registered customer after calling the [requestPasswordResetEmail]({{page.baseurl}}/graphql/mutations/request-password-reset-email.html) mutation. + +## Syntax + +`mutation: {resetPassword(email: String!, resetPasswordToken: String!, newPassword: String!): Boolean}` + +## Example usage + +The following call sets a new customer password. + +**Request:** + +```graphql +mutation { + resetPassword( + email: "roni_cost@example.com", + resetPasswordToken: "gh80pkjGdsPyiXc0sUUXswX1uGN7crUr", + newPassword: "new_password" + ) +} +``` + +**Response:** + +```json +{ + "data": { + "resetPassword": true + } +} +``` + +## Input arguments + +The `resetPassword` mutation must contain the following arguments: + +Argument | Type | Description +--- | --- | --- +`email` | String! | Specifies the customer account that needs a password reset +`resetPasswordToken` | String! | A runtime token. You can find it in the reset email URL (see [requestPasswordResetEmail]({{page.baseurl}}/graphql/mutations/request-password-reset-email.html) mutation) or in the `customer_entity`.`rp_token` database table. +`newPassword` | String! | The new password + +{:.bs-callout-info} +The new password must satisfy the password policies set for the store. + +## Output + +The `resetPassword` mutation returns `true` if the request was successful. Otherwise, it returns `false`. + +## Errors + +Error | Description +--- | --- +`Cannot set 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. +`newPassword must be specified` | The `newPassword` argument is empty. +`resetPasswordToken must be specified` | The `resetPasswordToken` argument is empty. +`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.` | The `email` argument is empty. + +## Related topics + +- [requestPasswordResetEmail mutation]({{page.baseurl}}/graphql/mutations/request-password-reset-email.html)