mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
captcha changes
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9390 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1e36ed1f74
commit
01078bb2fa
9 changed files with 66 additions and 13 deletions
|
@ -22,6 +22,11 @@
|
|||
<dd><label><input type="radio" class="radio" id="enable_post_confirm" name="enable_post_confirm" value="1"<!-- IF POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_ENABLED}</label>
|
||||
<label><input type="radio" class="radio" name="enable_post_confirm" value="0"<!-- IF not POST_ENABLE --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</label></dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="confirm_refresh">{L_VISUAL_CONFIRM_REFRESH}:</label><br /><span>{L_VISUAL_CONFIRM_REFRESH_EXPLAIN}</span></dt>
|
||||
<dd><label><input type="radio" class="radio" id="confirm_refresh" name="confirm_refresh" value="1"<!-- IF CONFIRM_REFRESH --> checked="checked"<!-- ENDIF --> /> {L_ENABLED}</label>
|
||||
<label><input type="radio" class="radio" name="confirm_refresh" value="0"<!-- IF not CONFIRM_REFRESH --> checked="checked"<!-- ENDIF --> /> {L_DISABLED}</label></dd>
|
||||
</dl>
|
||||
<!-- IF GD -->
|
||||
<dl>
|
||||
<dt><label for="captcha_gd">{L_CAPTCHA_GD}:</label><br /><span>{L_CAPTCHA_GD_EXPLAIN}</span></dt>
|
||||
|
@ -53,6 +58,14 @@
|
|||
<label><input name="captcha_gd_3d_noise" value="0" class="radio" type="radio"<!-- IF not CAPTCHA_GD_3D_NOISE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl>
|
||||
<dt><label for="captcha_gd_fonts">{L_CAPTCHA_GD_FONTS}:</label><br /><span>{L_CAPTCHA_GD_FONTS_EXPLAIN}</span></dt>
|
||||
<dd><label><input id="captcha_gd_fonts" name="captcha_gd_fonts" value="1" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 1 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_DEFAULT}</label>
|
||||
<label><input name="captcha_gd_fonts" value="2" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 2 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_NEW}</label>
|
||||
<label><input name="captcha_gd_fonts" value="3" class="radio" type="radio"<!-- IF CAPTCHA_GD_FONTS == 3 --> checked="checked"<!-- ENDIF --> /> {L_CAPTCHA_FONT_LOWER}</label>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<!-- ENDIF -->
|
||||
|
||||
</fieldset>
|
||||
|
|
|
@ -35,6 +35,7 @@ class acp_captcha
|
|||
'captcha_gd' => 'CAPTCHA_GD_PREVIEWED',
|
||||
'captcha_gd_wave' => 'CAPTCHA_GD_WAVE',
|
||||
'captcha_gd_3d_noise' => 'CAPTCHA_GD_3D_NOISE',
|
||||
'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS',
|
||||
|
||||
);
|
||||
|
||||
|
@ -61,6 +62,7 @@ class acp_captcha
|
|||
$config_vars = array(
|
||||
'enable_confirm' => 'REG_ENABLE',
|
||||
'enable_post_confirm' => 'POST_ENABLE',
|
||||
'confirm_refresh' => 'CONFIRM_REFRESH',
|
||||
'captcha_gd' => 'CAPTCHA_GD',
|
||||
);
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ class ucp_register
|
|||
include($phpbb_root_path . 'includes/functions_profile_fields.' . $phpEx);
|
||||
|
||||
$confirm_id = request_var('confirm_id', '');
|
||||
$confirm_refresh = (isset($_POST['confirm_refresh']) && $config['confirm_refresh']) ? ((!empty($_POST['confirm_refresh'])) ? 1 : 0) : false;
|
||||
$coppa = (isset($_REQUEST['coppa'])) ? ((!empty($_REQUEST['coppa'])) ? 1 : 0) : false;
|
||||
$agreed = (!empty($_POST['agreed'])) ? 1 : 0;
|
||||
$submit = (isset($_POST['submit'])) ? true : false;
|
||||
|
@ -448,7 +449,7 @@ class ucp_register
|
|||
|
||||
if ($config['enable_confirm'])
|
||||
{
|
||||
if ($change_lang)
|
||||
if ($change_lang || $confirm_refresh)
|
||||
{
|
||||
$str = '&change_lang=' . $change_lang;
|
||||
$sql = 'SELECT code
|
||||
|
@ -467,7 +468,7 @@ class ucp_register
|
|||
{
|
||||
$str = '';
|
||||
}
|
||||
if (!$change_lang || !$confirm_id)
|
||||
if (!$change_lang || !$confirm_id || !$confirm_refresh)
|
||||
{
|
||||
$user->confirm_gc(CONFIRM_REG);
|
||||
|
||||
|
@ -500,6 +501,24 @@ class ucp_register
|
|||
);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
else if ($confirm_refresh)
|
||||
{
|
||||
$code = gen_rand_string(mt_rand(5, 8));
|
||||
$confirm_id = md5(unique_id($user->ip));
|
||||
$seed = hexdec(substr(unique_id(), 4, 10));
|
||||
// compute $seed % 0x7fffffff
|
||||
$seed -= 0x7fffffff * floor($seed / 0x7fffffff);
|
||||
$sql = 'UPDATE ' . CONFIRM_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array(
|
||||
'confirm_type' => (int) CONFIRM_REG,
|
||||
'code' => (string) $code,
|
||||
'seed' => (int) $seed) . "
|
||||
WHERE
|
||||
confirm_id = '" . $db->sql_escape($confirm_id) . "' AND
|
||||
session_id = '" . $db->sql_escape($session_id) . "' AND
|
||||
confirm_type = " . (int) CONFIRM_REG
|
||||
);
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
$confirm_image = '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_REG . $str) . '" alt="" title="" />';
|
||||
$s_hidden_fields .= '<input type="hidden" name="confirm_id" value="' . $confirm_id . '" />';
|
||||
}
|
||||
|
@ -534,6 +553,7 @@ class ucp_register
|
|||
'S_LANG_OPTIONS' => language_select($data['lang']),
|
||||
'S_TZ_OPTIONS' => tz_select($data['tz']),
|
||||
'S_CONFIRM_CODE' => ($config['enable_confirm']) ? true : false,
|
||||
'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false,
|
||||
'S_COPPA' => $coppa,
|
||||
'S_HIDDEN_FIELDS' => $s_hidden_fields,
|
||||
'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
|
||||
|
|
|
@ -893,6 +893,10 @@ function change_database_data(&$no_updates, $version)
|
|||
|
||||
set_config('captcha_gd_wave', 0);
|
||||
set_config('captcha_gd_3d_noise', 1);
|
||||
set_config('captcha_gd_fonts', 1);
|
||||
set_config('confirm_refresh', 1);
|
||||
|
||||
|
||||
|
||||
$sql = 'SELECT user_id, user_password
|
||||
FROM ' . USERS_TABLE . '
|
||||
|
|
|
@ -66,6 +66,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid'
|
|||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_y_grid', '25');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_wave', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_3d_noise', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_fonts', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('confirm_refresh', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_attachment_content', '1');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('check_dnsbl', '0');
|
||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('chg_passforce', '0');
|
||||
|
|
|
@ -247,6 +247,12 @@ $lang = array_merge($lang, array(
|
|||
'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the CAPTCHA.',
|
||||
'CAPTCHA_GD_3D_NOISE' => 'Add 3D-noise objects',
|
||||
'CAPTCHA_GD_3D_NOISE_EXPLAIN' => 'This adds additional objects to the CAPTCHA, over the letters.',
|
||||
'CAPTCHA_GD_FONTS' => 'Use different fonts',
|
||||
'CAPTCHA_GD_FONTS_EXPLAIN' => 'This setting controls how many different letter shapes are used. You can just use the default shapes or introduce altered letters. Adding lowercase letters is also possible.',
|
||||
'CAPTCHA_FONT_DEFAULT' => 'Default',
|
||||
'CAPTCHA_FONT_NEW' => 'New Shapes',
|
||||
'CAPTCHA_FONT_LOWER' => 'Also use lowercase',
|
||||
|
||||
|
||||
'CAPTCHA_PREVIEW_MSG' => 'Your changes to the visual confirmation setting were not saved. This is just a preview.',
|
||||
'CAPTCHA_PREVIEW_EXPLAIN' => 'The CAPTCHA as it will look like using the current settings. Use the preview button to refresh. Note that captchas are randomized and will differ from one view to the next.',
|
||||
|
@ -254,6 +260,8 @@ $lang = array_merge($lang, array(
|
|||
'VISUAL_CONFIRM_POST_EXPLAIN' => 'Requires anonymous users to enter a random code matching an image to help prevent mass postings.',
|
||||
'VISUAL_CONFIRM_REG' => 'Enable visual confirmation for registrations',
|
||||
'VISUAL_CONFIRM_REG_EXPLAIN' => 'Requires new users to enter a random code matching an image to help prevent mass registrations.',
|
||||
'VISUAL_CONFIRM_REFRESH' => 'Enable users to request new images',
|
||||
'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request new images, if they are unable to solve the VC.',
|
||||
));
|
||||
|
||||
// Cookie Settings
|
||||
|
|
|
@ -122,6 +122,9 @@ $lang = array_merge($lang, array(
|
|||
'CONFIRM_EMAIL' => 'Confirm e-mail address',
|
||||
'CONFIRM_EMAIL_EXPLAIN' => 'You only need to specify this if you are changing your e-mail address.',
|
||||
'CONFIRM_EXPLAIN' => 'To prevent automated registrations the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.',
|
||||
'VC_REFRESH' => 'New Image',
|
||||
'VC_REFRESH_EXPLAIN' => 'If you cannot read the code, then you can request a new one by clicking the button.',
|
||||
|
||||
'CONFIRM_PASSWORD' => 'Confirm password',
|
||||
'CONFIRM_PASSWORD_EXPLAIN' => 'You only need to confirm your password if you changed it above.',
|
||||
'COPPA_BIRTHDAY' => 'To continue with the registration procedure please tell us when you were born.',
|
||||
|
|
|
@ -87,7 +87,8 @@
|
|||
<dt><label for="confirm_code">{L_CONFIRM_CODE}:</label></dt>
|
||||
<dd>{CONFIRM_IMG}</dd>
|
||||
<dd><input type="text" name="confirm_code" id="confirm_code" size="8" maxlength="8" class="inputbox narrow" title="{L_CONFIRM_CODE}" /></dd>
|
||||
<dd>{L_CONFIRM_CODE_EXPLAIN}</dd>
|
||||
<dd>{L_CONFIRM_CODE_EXPLAIN}<!-- IF S_CONFIRM_REFRESH --> {L_VC_REFRESH_EXPLAIN}<!-- ENDIF --></dd>
|
||||
<!-- IF S_CONFIRM_REFRESH --><dd><input type="submit" value="{L_VC_REFRESH}" class="button2" /></dd> <!-- ENDIF -->
|
||||
</dl>
|
||||
</fieldset>
|
||||
<!-- ENDIF -->
|
||||
|
@ -113,7 +114,7 @@
|
|||
<fieldset class="submit-buttons">
|
||||
{S_HIDDEN_FIELDS}
|
||||
<input type="reset" value="{L_RESET}" name="reset" class="button2" />
|
||||
<input type="submit" name="submit" id ="submit" value="{L_SUBMIT}" class="button1" />
|
||||
<input type="submit" name="submit" id="submit" value="{L_SUBMIT}" class="button1" />
|
||||
{S_FORM_TOKEN}
|
||||
</fieldset>
|
||||
|
||||
|
|
|
@ -88,8 +88,8 @@
|
|||
<td class="row1" colspan="2" align="center">{CONFIRM_IMG}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="row1"><b class="genmed">{L_CONFIRM_CODE}: </b><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN}</span></td>
|
||||
<td class="row2"><input class="post" type="text" name="confirm_code" size="8" maxlength="8" /></td>
|
||||
<td class="row1"><b class="genmed">{L_CONFIRM_CODE}: </b><br /><span class="gensmall">{L_CONFIRM_CODE_EXPLAIN} <!-- IF S_CONFIRM_REFRESH -->{L_VC_REFRESH_EXPLAIN}<!-- ENDIF --></span></td>
|
||||
<td class="row2"><input class="post" type="text" name="confirm_code" size="8" maxlength="8" /><!-- IF S_CONFIRM_REFRESH --> <input type="submit" value="{L_VC_REFRESH}" class="btnlite" /><!-- ENDIF --></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue