---
title: "activate_customer_password_form"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/sline/tag/activate-customer-password-form'
  md: 'https://developer.shopline.com/docs/sline/tag/activate-customer-password-form.md'
---

# activate_customer_password_form


    Generates a form for activating a customer account. After the merchant sends an activation email, the customer can click the link in the email to access the activation page and set a password to activate their account.

    ## Form input

**customer[password]** string **required**

Password.

Maximum length: 40

Minimum length: 5

**customer[accepts_marketing]** boolean

Whether the customer accepts email marketing.
- `true`: Accepts email subscriptions
- `false`: Does not accept email subscriptions



```sline
{{#activate_customer_password_form}}
    form_content
{{/activate_customer_password_form}}
```









    
## Example

        
            

            The following example is used to generate a customer account activation form.

            

            
<SlineExample path={'/user/activate'} objects={ 
    [""] 
}>
```sline
{{#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>
```
</SlineExample>
            
        
    
