Skip to content

MediaWiki ​

Official CaptchaLa extension for MediaWiki. It is a driver for the ConfirmEdit extension, so it plugs into the same triggers as ConfirmEdit's built-in CAPTCHAs and is configured in LocalSettings.php.

Every widget is backed by a server-issued, single-use token, and each submission is checked on your server before MediaWiki saves anything.

What it covers ​

FormConfirmEdit triggerAction
Account creation (Special:CreateAccount)createaccountregister
Page editseditcomment
Edits that add external linksaddurlcomment
Email a user (Special:EmailUser)sendemailcontact_form
Login after failed attempts (Special:UserLogin)badloginlogin

The first four are on by default ($wgCaptchalaTriggers). Login after failed attempts follows ConfirmEdit's own $wgCaptchaTriggers setting. Members of trusted groups are not challenged (see $wgCaptchalaSkipUserGroups). On the edit form the check is bound to Save changes; Show preview and Show changes are not challenged.

When a check fails, ConfirmEdit refuses the submission and shows its error on the form.

Requirements ​

  • MediaWiki 1.43 or later
  • ConfirmEdit 1.6 or later
  • PHP 8.0+ and Composer
  • A CaptchaLa account — get your App Key + App Secret at dash.captcha.la

Install ​

  1. Clone the GitHub repository into extensions/Captchala (the folder name matters).

  2. Install the PHP SDK in that folder:

    bash
    cd extensions/Captchala
    composer install --no-dev
  3. Load ConfirmEdit and Captchala in LocalSettings.php and add your keys:

    php
    wfLoadExtension( 'ConfirmEdit' );
    wfLoadExtension( 'Captchala' );
    
    $wgCaptchalaAppKey    = 'your-app-key';
    $wgCaptchalaAppSecret = 'your-app-secret';

Captchala becomes the active ConfirmEdit driver when no other one is set. If LocalSettings.php already sets $wgCaptchaClass to another driver, point it at Captchala:

php
$wgCaptchaClass = 'MediaWiki\\Extension\\Captchala\\Captchala';

Configure ​

All settings go in LocalSettings.php:

SettingDefaultDescription
$wgCaptchalaAppKey''Public key from the CaptchaLa dashboard. Required.
$wgCaptchalaAppSecret''Server secret, used to issue and validate tokens. Required; never sent to the browser.
$wgCaptchalaProduct'bind'bind (the check runs when the visitor presses the form's submit button), popup, float or embed (a verification bar inside the form).
$wgCaptchalaLang'auto'A BCP-47 tag such as ja or pt-BR, or auto to follow the visitor's browser.
$wgCaptchalaTriggers['createaccount', 'edit', 'addurl', 'sendemail']The ConfirmEdit triggers CaptchaLa protects.
$wgCaptchalaSkipUserGroups['sysop', 'autoconfirmed']Members of these groups are not challenged.

Triggers that are on in ConfirmEdit's $wgCaptchaTriggers (such as badlogin) are protected as well. For example, to stop challenging every edit and keep the check only for edits that add links:

php
$wgCaptchalaTriggers = [ 'createaccount', 'addurl', 'sendemail' ];

Until both keys are set, protected forms show a notice that CAPTCHA is not configured.

Screenshots ​

MediaWiki account creation form with the CaptchaLa security check above Create your account

MediaWiki edit form with the CaptchaLa security check above Save changes

Notes ​

  • Privacy. The extension stores nothing in the wiki database.

  • Logs. Decisions are written to the captchala log channel. To collect them in a file:

    php
    $wgDebugLogGroups['captchala'] = "$IP/cache/captchala.log";

Troubleshooting ​

  • The old CAPTCHA still appears. Another ConfirmEdit driver is set in $wgCaptchaClass. Set it to Captchala as shown in Install.
  • Every submission is refused. Make sure the App Key and App Secret belong to the same app, and that your wiki's domain is allowed for that app in the dashboard.
  • Trying it out. The public test keys let you check the full flow without an account.

MIT-licensed examples · CaptchaLa is operated independently