customers/reset_password

customers/reset_password(客户/重置密码)模板渲染重置密码页面,该页面包含重置客户账户密码的表单。

提示
请参考 customers/reset_password 模板及其在 Dawn 中的主要分区,以了解实施示例。

位置

customers/reset_password 模板位于主题的templates > customers 目录中:

└── theme
    ├── layout
    ├── templates
    |   └── customers
    |     ├── reset_password.json
    |     ...
    ...

内容

您应该在customers/account模板中或模板内的一个部分中包含密码重置表单。

小贴士
如果您正在使用JSON模板,则任何HTML或Liquid代码都需要包含在模板引用的部分中。

密码重置表单

可以使用Liquid表单标签和相应的’reset_customer_password’参数添加密码重置表单。在表单标签块内,您需要包含以下内容:

Input类型name
Passwordpasswordcustomer[password]
Password confirmationpasswordcustomer[password_confirmation]

例子

{%- form 'reset_customer_password' -%}
  {{ form.errors | default_errors }}

  <div class="password">
    <input
      type="password"
      name="customer[password]"
      id="password"
    >
    <label for="password">Password</label>
  </div>

  <div class="password_confirm">
    <input
      type="password"
      name="customer[password_confirmation]"
      id="password_confirmation"
    >
    <label for="password_confirmation">Confirm password</label>
  </div>

  <button>Reset password</button>
{%- endform -%}

应用

在使用customers/reset_password模板时,您应该熟悉如何预览该模板。要预览customers/reset_password模板,请执行以下步骤:

  • 在登录页面填写密码恢复表单。
  • 检查您的电子邮件,查找“客户账户密码重置”的电子邮件。
  • 点击电子邮件中的链接。这将带您前往客户密码重置页面。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注