PHPackages                             johannschopplich/kirby-locked-pages - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. johannschopplich/kirby-locked-pages

ActiveKirby-plugin[Security](/categories/security)

johannschopplich/kirby-locked-pages
===================================

Password-protect pages for the Kirby CMS

2.2.0(9mo ago)403.9k3[2 issues](https://github.com/johannschopplich/kirby-locked-pages/issues)MITPHP

Since Dec 24Pushed 9mo ago2 watchersCompare

[ Source](https://github.com/johannschopplich/kirby-locked-pages)[ Packagist](https://packagist.org/packages/johannschopplich/kirby-locked-pages)[ Docs](https://github.com/johannschopplich/kirby-locked-pages#readme)[ RSS](/packages/johannschopplich-kirby-locked-pages/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (2)Versions (22)Used By (0)

 [![Kirby Locked Pages logo](./.github/favicon.svg)](./.github/favicon.svg)Kirby Locked Pages
==================

[](#kirby-locked-pages)

Password-protect a page – and its entire subtree – behind a login form, for the Kirby CMS.

[Features](#features) • [Options](#options) • [Security Scope](#security-scope)

When to Use
-----------

[](#when-to-use)

I want to…UsePassword-protect a page and its children`fields/locked-pages` blueprint groupGive visitors a logout link`locked-pages.logout` hookRestyle the password form`site/templates/locked-pages-login.php`Check lock state from my own code`Guard::isLocked($page)`Change the login slug, title, or error messages`johannschopplich.locked-pages` optionsFeatures
--------

[](#features)

### 🔒 Password Protection

[](#-password-protection)

Toggle protection on any page through a globally registered blueprint field group. Visitors are redirected to a login form until they enter the correct password, and the grant is then stored in their session.

```
sections:
  access:
    type: fields
    fields:
      protection: fields/locked-pages
```

The group adds a `lockedPagesEnable` toggle and a `lockedPagesPassword` field. Drafts and the error page are never locked, even when the fields are set.

### 🌳 Subtree Inheritance

[](#-subtree-inheritance)

Locking a page locks its whole subtree – you only add the field group at the subtree root. Unlocking the parent grants access to every descendant, keyed by the page's language-independent ID, so one unlock covers all translations. Content representations (`.json`, `.xml`, `.rss`, …) are locked alongside the page.

### 🚪 Logout Hook

[](#-logout-hook)

Clear a visitor's grants by triggering the `locked-pages.logout` hook. Wire it to a route, then show a logout link only while the session holds a grant.

```
// config.php
return [
    'routes' => [
        [
            'pattern' => 'logout',
            'action' => function () {
                kirby()->trigger('locked-pages.logout');
                go('/');
            }
        ]
    ]
];
```

```
