X-Git-Url: https://git.toastfreeware.priv.at/toast/cookiecaptcha.git/blobdiff_plain/b0bc51855c95ea8be6d640f3bf45db9bdf0313c7..9566eb1a0e32dda84caa53dce8bdcb70a6a8c483:/ConfirmEdit.php diff --git a/ConfirmEdit.php b/ConfirmEdit.php index ceb4842..7a4f78a 100644 --- a/ConfirmEdit.php +++ b/ConfirmEdit.php @@ -35,10 +35,12 @@ global $wgExtensionFunctions, $wgGroupPermissions; $wgExtensionFunctions[] = 'confirmEditSetup'; $wgExtensionCredits['other'][] = array( + 'path' => __FILE__, 'name' => 'ConfirmEdit', 'author' => 'Brion Vibber', 'url' => 'http://www.mediawiki.org/wiki/Extension:ConfirmEdit', 'description' => 'Simple captcha implementation', + 'descriptionmsg' => 'captcha-desc', ); /** @@ -54,6 +56,7 @@ $wgGroupPermissions['user' ]['skipcaptcha'] = false; $wgGroupPermissions['autoconfirmed']['skipcaptcha'] = false; $wgGroupPermissions['bot' ]['skipcaptcha'] = true; // registered bots $wgGroupPermissions['sysop' ]['skipcaptcha'] = true; +$wgAvailableRights[] = 'skipcaptcha'; /** * List of IP ranges to allow to skip the captcha, similar to the group setting: @@ -145,6 +148,13 @@ $wgCaptchaBadLoginExpiration = 5 * 60; global $ceAllowConfirmedEmail; $ceAllowConfirmedEmail = false; +/** + * Number of bad login attempts before triggering the captcha. 0 means the + * captcha is presented on the first login. + */ +global $wgCaptchaBadLoginAttempts; +$wgCaptchaBadLoginAttempts = 3; + /** * Regex to whitelist URLs to known-good sites... * For instance: @@ -165,11 +175,11 @@ $wgCaptchaWhitelist = false; $wgCaptchaRegexes = array(); /** Register special page */ -global $wgSpecialPages; $wgSpecialPages['Captcha'] = array( /*class*/'CaptchaSpecialPage', /*name*/'Captcha' ); $wgConfirmEditIP = dirname( __FILE__ ); $wgExtensionMessagesFiles['ConfirmEdit'] = "$wgConfirmEditIP/ConfirmEdit.i18n.php"; +$wgExtensionAliasesFiles['ConfirmEdit'] = "$wgConfirmEditIP/ConfirmEdit.alias.php"; if ( defined( 'MW_SUPPORTS_EDITFILTERMERGED' ) ) { $wgHooks['EditFilterMerged'][] = 'ConfirmEditHooks::confirmEditMerged'; @@ -181,6 +191,8 @@ $wgHooks['AbortNewAccount'][] = 'ConfirmEditHooks::confirmUserCreate'; $wgHooks['LoginAuthenticateAudit'][] = 'ConfirmEditHooks::triggerUserLogin'; $wgHooks['UserLoginForm'][] = 'ConfirmEditHooks::injectUserLogin'; $wgHooks['AbortLogin'][] = 'ConfirmEditHooks::confirmUserLogin'; +# Register API hook +$wgHooks['APIEditBeforeSave'][] = 'ConfirmEditHooks::confirmEditAPI'; $wgAutoloadClasses['ConfirmEditHooks'] = $wgAutoloadClasses['SimpleCaptcha']