Plugin screenshot thumbnail 1/2
Plugin screenshot thumbnail 2/2

Password protect any page or entry.

  • Protect one or more pages.
  • Protect multiple entries each with their own password.
  • Customize the login page.

Examples

Protect a single page

The easiest way to get started is by adding the following line of code to the template you want to protect.

{% do craft.templateGuard.protect('Pa$$w0rd') %}

You can also use a password that was stored on the entry.

{% do craft.templateGuard.protect(entry.myPasswordField) %}

Provide multiple passwords: any of the passwords provided in the array can be used to log in.

{% do craft.templateGuard.protect(['passwords1', 'passwords2']) %}

Protect multiple pages with the same password

Here we've added a second argument, a key that identifies a group of protected pages. Add this line to every template you want to protect with that password.

Once logged in to one of those pages, you'll have access to all of the other pages in that group.

{% do craft.templateGuard.protect('Pa$$w0rd', 'secret-pages-group') %}

Protect multiple entries each with their own password

Add this line to the template(s) rendering your entries.

{% do craft.templateGuard.protect(entry.myPasswordField, entry.uid) %}

Usage

This plugin gives you access to a protect method in your templates. This will redirect users to a login page.

{% do craft.templateGuard.protect('password', 'key') %}

Arguments

Password (string, array)

The password your users need to provide before accessing the page. You can also provide an array of passwords. The page will not be protected when the password is an empty string or array.

Key (string - optional)

You can identify a protected area on your site using the key argument. When logged in to a page with a certain key, other pages using the same key will also be accessible. The current url is used as the default key.

Price includes 1 year of updates.
$9/year per site for updates after that.

Installation Instructions

To install this plugin, copy the command above to your terminal.

Active Installs
50
Version
2.0.0-beta.1
License
Craft
Compatibility
Craft 3, Craft 4
Last release
March 31, 2022
Activity (30 days)
1
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs