# Protect:Password_Form

This tag is used to create a custom content [password protection](/protecting-content.md#password) form.

## Overview

The HTML of the form itself is up to you. The only requirement is to name the password input `password` and wrap the form with the tag pair.

Any variables from the protected entry will also be available in the password form.

## Example

::tabs

::tab antlers
```antlers
{{ protect:password_form }}
    {{ if invalid_token }}
        No token has been provided.
    {{ else }}

        {{ if error }}
            <div class="error">{{ error }}</div>
        {{ /if }}

        <input type="password" name="password" />

        {{ errors:password }}
            <div class="inline-error">{{ value }}</div>
        {{ /errors:password }}

        <button>Submit</button>

    {{ /if }}
{{ /protect:password_form }}
```
::tab blade
```blade
<s:protect:password_form>
  @if ($no_token)
    No token has been provided.
  @else
    @if ($error)
      <div class="error">{{ $error }}</div>
    @endif

    <input type="password" name="password" />

    @if (isset($errors['password']))
      @foreach ($errors['password'] as $error)
        <div class="inline-error">{{ $error }}</div>
      @endforeach
    @endif

    <button>Submit</button>
  @endif
</s:protect:password_form>
```
::

### Tokens

When visiting a password protected page, Statamic generates a token and appends it to the form’s URL. Without this token, the form cannot function correctly. This is to combat brute-forcing and bots.

In the example above, you can see the `invalid_token` boolean will be populated for you. This may happen if you visit the form URL directly.
