Invite Access

Restricts site access to visitors with a valid invite code. Designed for staging environments with multiple teams.

Restricts site access to visitors with a valid invite code. Designed for staging environments with multiple teams.


Features


  • Multiple invite codes — one per line, with optional human-readable labels
  • Session-based auth — visitors enter the code once, stay in for a configurable duration
  • Access log — JSON log with timestamp, IP, user agent, URL and code label for every attempt
  • Light / Dark / Auto theme on the access page — preference saved in localStorage
  • Superuser always bypasses — logged-in ProcessWire users are never blocked
  • Allowed pages — specific pages can be made publicly accessible even while the site is locked
  • Clean, minimal UI — ApfelGrotezk font, processwire.com-inspired design, Bootstrap Icons
  • Accent color presets — red, blue, green or black, configurable per-install

Installation


  1. Download or clone the repository into your site/modules/ directory:
cd site/modules
git clone https://github.com/mxmsmnv/InviteAccess.git
  1. In the ProcessWire admin, go to Modules → Refresh, then find InviteAccess and click Install.

  2. Configure the module under Modules → Configure → InviteAccess.


Configuration


FieldDescriptionDefault
Enable Invite AccessMaster on/off switchoff
Invite CodesOne code per line, optional code|Label format
Access Page TitleHeading shown on the access gate pageAccess Required
MessageSubtext shown below the headingPlease enter your invite code to continue.
Error MessageShown when an invalid code is submittedInvalid invite code. Please try again.
Button LabelText on the submit buttonContinue
StyleAccent color for button and input focus border: red, blue, green, blackred
Session DurationHours before the visitor must re-enter their code1
Always Accessible PagesPages that bypass the invite check entirely
Enable access loggingWrite all access attempts to a JSON fileon
Log file pathCustom path for the log file (optional)site/assets/logs/invite-access.json

Invite Code Format


Codes are defined one per line in the Invite Codes field. You can optionally add a pipe-separated label that appears in the access log:

SUMMER2025|Summer Campaign
AGENCY-PREVIEW|Agency Team
CLIENT-ACCESS|Client Preview
# this line is a comment and will be ignored
PLAINCODE

Labels make it easy to identify which team or campaign each access attempt belongs to when reading the log.


Access Log


When logging is enabled, every access attempt is written to a JSON file (newest first). Each entry contains:

{
  "time": "2026-02-27 14:32:10",
  "timestamp": 1772179930,
  "success": true,
  "code": "AGENCY-PREVIEW",
  "code_label": "Agency Team",
  "ip": "93.184.216.34",
  "ua": "Mozilla/5.0 ...",
  "url": "/about/"
}

Failed attempts log "success": false and redact the submitted value to (invalid: ...). The log is capped at 1000 entries. The last 50 entries are also displayed directly in the module's admin config page.


How It Works


The module hooks into ProcessPageView::execute — the earliest point in ProcessWire's request lifecycle — before any template or page rendering occurs. This ensures the gate fires reliably on all frontend URLs without interfering with the admin panel.

On a valid code submission, the module stores the code and an expiry timestamp in the ProcessWire session. Subsequent requests validate against the session without touching the database. If a code is removed from the config, any active session using that code is immediately invalidated.


Security Notes


  • Codes are compared using hash_equals() to prevent timing attacks
  • CSRF token is included in the access form
  • IP detection respects Cloudflare (CF-Connecting-IP) and proxy headers (X-Forwarded-For)
  • The module is intended for staging environments, not as a substitute for HTTP authentication on sensitive production data

Author


Maxim Alex smnv.org · GitHub @mxmsmnv


License


MIT License. See LICENSE for details.

More modules by Maxim Semenov

  • Context

    Export ProcessWire site context for AI development (JSON + TOON formats)
  • WireWall

    Advanced traffic firewall with VPN/Proxy/Tor detection, rate limiting, and JS challenge
  • LQRS URL Shortener Profile

    This site profile for ProcessWire offers a free and easy-to-use URL shortener that transforms long links into concise, shareable URLs. It is built using standard ProcessWire modules and field types.
  • Media Platform Profile

    This site profile for ProcessWire offers a fully-featured media platform for hosting and managing video content with Backblaze B2 and Cloudflare integration.
  • AgeWire

    Age verification module with Tailwind CSS support
  • 2048

    Take a break with 2048 game in ProcessWire admin
  • GeoIP

    MaxMind GeoLite2-based geolocation. Country/region/city detection with user correction support and conditional content blocks.
  • Invite Access

    Restricts site access to visitors with a valid invite code. Designed for staging environments with multiple teams.
  • WirePDF

    Convert ProcessWire pages to PDF documents with advanced typography support

All modules by Maxim Semenov

Install and use modules at your own risk. Always have a site and database backup before installing new modules.