resetPassword mutation
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 mutation.
The new password must satisfy the password policies set for the store.
The mutation returns true
if the request was successful. Otherwise, it returns false
.
The reset password token value can also be found in the customer_entity
.rp_token
database table.
Syntax
mutation: {resetPassword(email: String!, resetPasswordToken: String!, newPassword: String!): Boolean}
Reference
The resetPassword
reference provides detailed information about the types and fields defined in this mutation.
Example usage
The following call sets a new customer password.
Request:
Copied to your clipboardmutation {resetPassword(email: "roni_cost@example.com",resetPasswordToken: "gh80pkjGdsPyiXc0sUUXswX1uGN7crUr",newPassword: "new_password")}
Response:
Copied to your clipboard{"data": {"resetPassword": true}}
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 application 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. |