Setup ReCaptcha in Wiki to Prevent Spam

Modified settings file to remove questy captcha and add recaptcha.
Setup two new variables to hold public and private recaptcha keys
wg_recaptchapublickey and wg_recaptchaprivatekey.

Change-Id: Idfa2c01fb9d31f06643d6c82438c33db1ff33009
This commit is contained in:
JP Maxwell 2016-07-13 15:44:40 -05:00
parent 82f791aa3d
commit d1f42c7518
2 changed files with 14 additions and 12 deletions

View File

@ -11,9 +11,10 @@ class mediawiki(
$ssl_chain_file_contents = undef, # If left empty puppet will not create file.
$ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key',
$ssl_key_file_contents = undef, # If left empty puppet will not create file.
$wg_recaptchapublickey = undef,
$wg_recaptchaprivatekey = undef,
# TODO(fungi): wg_captchaquestions can be removed once 342372 merges
$wg_captchaquestions = {},
# TODO(pabelanger): Remove this once 284418 lands.
$wg_captchaquestions_answer = undef,
$wg_googleanalyticsaccount = undef,
$wg_dbpassword = undef,
$wg_secretkey = undef,

View File

@ -189,16 +189,14 @@ $wgNamespacesWithSubpages[110] = true;
## Extensions
# https://www.mediawiki.org/wiki/Extension:QuestyCaptcha
require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
require_once( "$IP/extensions/ConfirmEdit/QuestyCaptcha.php" );
$wgCaptchaClass = 'QuestyCaptcha';
$arr = array (
<% @wg_captchaquestions.each do|key, val| -%>
"<%= key %>" => "<%= val %>",
<% end -%>
);
foreach ( $arr as $key => $value ) {
$wgCaptchaQuestions[] = array( 'question' => $key, 'answer' => $value );
}
#Enable ReCaptcha
require_once "$IP/extensions/ConfirmEdit/ReCaptcha.php";
$wgCaptchaClass = 'ReCaptcha';
$wgReCaptchaPublicKey = <%= @wg_recaptchapublickey %>;
$wgReCaptchaPrivateKey = <%= @wg_recaptchaprivatekey %>;
$wgMainCacheType = CACHE_ANYTHING;
$wgCaptchaTriggers['edit'] = true;
$wgCaptchaTriggers['create'] = true;
@ -207,7 +205,10 @@ $wgCaptchaTriggers['addurl'] = true;
$wgCaptchaTriggers['createaccount'] = true;
$wgCaptchaTriggers['badlogin'] = true;
#OpenID
require_once( "$IP/extensions/OpenID/OpenID.php" );
# Don't disallow non-openid logins
$wgOpenIDOnly = false;
# Automatically mark email addreses provided by openid as verified