I’m having trouble with a custom password change form I built for logged-in customers on my Shopify store. The form appears on the /account page where customers can update their passwords after logging in.
The issue is that when customers submit the form, they get redirected to /account/invalid_token instead of successfully changing their password. This is confusing because the password reset works perfectly fine when customers use the standard email recovery process.
Here’s my current form code:
{% form 'customer_password' %}
<h3>Update Your Password</h3>
{% if form.errors %}
<div class="error-message">
{% include 'icon-warning' %} {{ form.errors | default_errors }}
</div>
{% endif %}
<div class="input-group">
<input type="password"
id="new_password"
name="customer[password]"
placeholder="{{ 'customer.account.new_password' | t }}"
required />
</div>
<div class="input-group">
<input type="password"
id="confirm_password"
name="customer[password_confirmation]"
placeholder="{{ 'customer.account.confirm_password' | t }}"
required />
</div>
<div class="submit-group">
<input type="submit" value="Update Password" class="btn-primary" />
</div>
{% endform %}
What am I doing wrong with this form setup? How can I properly handle password changes for already authenticated customers?