activate_customer_password_form
生成激活账号表单。商家可以给账号未激活的客户发送激活邀请邮件,客户点击邮件中的账号激活链接将进入激活页面,输入密码后即可激活账号。
表单输入
customer[password] string required
密码。
最大长度限制:18
最小长度限制:6
customer[accepts_marketing] boolean
客户是否接受电子邮件订阅。
{{#activate_customer_password_form}}
form_content
{{/activate_customer_password_form}}
form_content
表单内容。
例子
激活客户
{{#activate_customer_password_form id="customer-activate-form"}}
<div class="password">
<label for="customer[password]">user password</label>
<input type="password" name="customer[password]" placeholder="user password" />
</div>
<div class="accepts-marketing">
<input type="checkbox" name="customer[accepts_marketing]" value="true">
<label for="accepts-marketing">Subscribe to email marketing</label>
</div>
<div class="submit">
<input class="submit-button" type="submit" value="Submit">
</div>
{{/activate_customer_password_form}}
<script>
class Activate {
constructor() {
this.form = document.querySelector('#customer-activate-form');
this.form.addEventListener('submit', this.onSubmitHandler.bind(this));
this.activate = new window.Shopline.customerAccount.Activate(this.form)
}
onSubmitHandler(e) {
e.preventDefault();
this.activate.submit()
.then(response => {
window.location.href = '/user/signIn';
})
.catch(error => {
// Handling failure
console.log(error)
})
}
}
// Initializing the JS SDK
window.Shopline.loadFeatures(
[
{
name: 'customer-account-api',
version: '0.3'
}
],
function(error) {
if (error) {
throw error;
}
new Activate();
}
);
</script>
这篇文章对你有帮助吗?
SHOPLINE