activate_customer_password
Generate an account activation form with the required field password. token is required to activate the account, clicking on the bounce from the activation email will carry the token parameter in the url.
Params
form_type{String}The name of the desired form type.content{String}The form contents.options.hash{Object}form html attributes,optionalreturns{String}html
Inputs
| input | type | name | required |
|---|---|---|---|
| password | password | customer[password] | yes |
| email marketing | checkbox | customer[acceptsEmailMarketing] | no |
Example
{{#form 'activate_customer_password' 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[acceptsEmailMarketing]" value="true">
<label for="accepts-marketing">Subscribe to email marketing</label>
</div>
<div class="submit">
<input class="submit-button" type="submit" value="Submit">
</div>
{{/form}}
Used in conjunction
The above code needs to be used in conjunction with the following 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();
}
);
Was this article helpful to you?