Search by

moosylvania / silverstripe-registrationguard

obj63mc

Configurable anti-spam guard for Silverstripe registration and entry forms, with a blocked-submission log and CMS admin.

Package info

github.com/Moosylvania/Silverstripe-RegistrationGuard

Type:silverstripe-vendormodule

pkg:composer/moosylvania/silverstripe-registrationguard

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.1.1 2026-08-19 19:23 UTC

This package is auto-updated.

Last update: 2026-08-19 19:26:44 UTC


README

CI License Packagist Version

Anti-spam for Silverstripe forms that create records — registrations, sweepstakes entries, anything a bot would like to submit ten thousand times.

The guard runs a signed dwell-time check, its own honeypot field, a per-IP rate limit, configurable hard blocks, and a scored "this text looks machine generated" heuristic. Everything it blocks is written to a log with the reasons, so you can tune the thresholds against your own traffic rather than guessing. Users get one generic error and are told nothing about which rule fired.

One install serves many forms: each form names a source, and a source supplies the target class, the field names and any threshold overrides.

Requirements

Module Silverstripe PHP
^2 (branch main) 6 8.3+
^1 (branch 1) 5 8.1+
composer require moosylvania/silverstripe-registrationguard

Then run dev/build?flush=1.

Quick start

Define a source for the form you want to protect:

# app/_config/registrationguard.yml
Moosylvania\RegistrationGuard\Service\RegistrationGuard:
  sources:
    members:
      target_class: SilverStripe\Security\Member
      field_map: {email: Email, first_name: FirstName, surname: Surname, dob: Dob}
      unique_fields: ['Email']
      min_age: 21

Add the guard fields to the form, and run the check in the action:

use Moosylvania\RegistrationGuard\Service\RegistrationGuard;

// in your Form's constructor, after the rest of your fields
$fields->merge(RegistrationGuard::guardFields('members'));

// in your action handler
public function doRegister($data, Form $form)
{
    $result = RegistrationGuard::create($this->getRequest())->check($data, 'members');

    if ($result->shouldStop()) {
        $result->applyTo($form);
        return $this->controller->redirectBack();
    }

    // ... create the member
}

That is the whole integration. There is also an opt-in mode that wires itself in via YAML with no PHP changes at all — see the docs below.

To make the gmail-alias duplicate check work, apply the canonical email extension to your target class:

SilverStripe\Security\Member:
  extensions:
    - Moosylvania\RegistrationGuard\Extension\EmailCanonicalExtension

Documentation

License

MIT. See LICENSE.