Methods to recover a customer's account login credentials by sending them a password reset email.

Use the recover method to send an email to the customer with a link to reset their password. If the email address provided doesn't exist in the system, no email will be sent.

Returns a value indicating success.

Send a password reset email
await swell.account.recover({
  email: 'julia@example.com'
})

To customize the password reset URL sent to the customer in an email, pass the optional parameter reset_url, including a placeholder for the password reset key: {reset_key}. Swell will automatically generate and substitute the password reset key in the URL before sending an email.

Customize reset password URL
await swell.account.recover({
  email: 'julia@example.com',
  reset_url: 'https://example.com/password-reset?key={reset_key}'
})

Password reset requests automatically expire after 24 hours.

Use to set the customer's new password. This requires the reset_key from the recovery email (see above). The password recovery email should link to your storefront with reset_key as a URL parameter that you can pass to this method.

Reset an account password
await swell.account.recover({
  password: 'thenewpassword',
  reset_key: 'e42e66fc7e3f00e9e179w20ad1841146'
})