Extension:EmailRegistrationFilter

From mediawiki.org
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
EmailRegistrationFilter
Release status: experimental
Implementation User identity
Description Allows or denies account registration according to the submitted email account.
Author(s) gaboflowerstalk
Latest version 0.1
MediaWiki 1.32+
License GNU General Public License 2.0 or later
Download
https://github.com/gaboflowers/EmailRegistrationFilter/blob/main/README.md

Check usage and version matrix.

The EmailRegistrationFilter checks an account creation, and forbids it following a blacklists of patterns (or only allows it following a whitelist, depending on the mode of use). It's intended to be a replacement for Extension:CheckEmailAddress. The extension works by extending a PrimaryAuthenticationProvider (actually, a LocalPasswordPrimaryAuthenticationProvider).

Installation[edit]

  • Download and place the file(s) in a directory called EmailRegistrationFilter in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php :
    wfLoadExtension( 'EmailRegistrationFilter' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parameters[edit]

Within the $IP/extensions/EmailRegistrationFilter/extension.json file:

$wgPatternList[edit]

List of preg_match patterns to be tested against an email address.

$wgIsWhiteList[edit]

True only allows a registation if the email matches a pattern in the value. If false, the PatternList becomes a blacklist.

$wgErrorMessage[edit]

Custom error message for a rejected registration.

Example[edit]

If you want to only allow .edu and .int domains to be able to register with email address, you can use the following configuration:

"config": {
    "PatternList": {
        "value": [
            "/.*@.*.edu$/",
            "/.*@.*.int$/"
        ],
        "description": "..."
    },
    "IsWhiteList": {
        "value": true,
        "description": "..."
    },
    "ErrorMessage": {
        "value": "Registration only allowed for .edu or .int domains",
        "description": "Custom error message"
    }
}

If you want to block only those domains, change the IsWhiteList value from true to false.