useCustomerResetPassword

A customer hook that helps you easily reset a customer password

// import
import { useCustomerResetPassword } from '@backpackjs/storefront';

// instantiation
const { resetPassword, ...resetStatus } = useCustomerResetPassword();

// use
const customer = await resetPassword({ password, url });

required props

password

the updated customer password

url

A valid Shopify password reset url

/templates/account/ResetPassword/ResetPasswordForm.jsx
// The password reset route will has params as props
const { customerId, resetToken } = params; // These come from Shopify's password reset email link

// password reset url
const url = `https://${process.env.SHOPIFY_DOMAIN}/account/reset/${customerId}/${resetToken}`;

returns

customer

if a reset was successful a full customer object will be returned else null

Last updated