Password reset
This guide explains how to configure BigCommerce so that customers can reset their password from Front-Commerce.
Add a custom attribute to Customers
A custom attribute named reset_password_token
must be added to BigCommerce
Customer. For that, you can use
the Customer Attribute API
to create it:
curl --request POST \
--url https://api.bigcommerce.com/stores/yhowbpps2e/v3/customers/attributes \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: authtoken' \
--data '[
{
"name": "reset_password_token",
"type": "string"
}
]'
To generate an auth token please refer to BigCommerce Access Tokens documentation.
Configure the email
When a customer reaches the password reset page and fills the form with a valid and recognized email, Front-Commerce will send an email to this customer so that they can change their password.
This link is valid for 20 minutes.
Configure the SMTP server and email sender
The SMTP server used to send this email must be configured through the
FRONT_COMMERCE_BIG_COMMERCE_RESET_PASSWORD_SMTP_CONNECTION_STRING
environment
variable while the sender of this email is configured in
FRONT_COMMERCE_BIG_COMMERCE_RESET_PASSWORD_SENDER_EMAIL_ADDRESS
:
# can also be a `smtp://` URL. Login, password and port are optional
FRONT_COMMERCE_BIG_COMMERCE_RESET_PASSWORD_SMTP_CONNECTION_STRING=smtps://login:password@example.com:465
# can also be a plain email address
FRONT_COMMERCE_BIG_COMMERCE_RESET_PASSWORD_SENDER_EMAIL_ADDRESS=My store <noreply@example.com>
Email template
The BigCommerce Password Reset template is used to generate the email subject and body. It can be customized from the control panel under Marketing > Transactional emails as explained in the Customizing Emails guide.
We do our best to replicate the environment in which the template is interpreted so that the preview and the actual email content work as expected, however there are a few differences between the BigCommerce environment and the Front-Commerce one:
- in global variables,
store.domain_name
,store.path
andstore.img_path
are based on the Front-Commerce URL - we only support
the
lang
handlebars template helper currently. Calling any other helper will result in an empty string and a warning will be logged. Please contact us if you have use cases requiring more than that.