From da96fe87a51b8e3dac93d7e705b8e5a8b0d251c8 Mon Sep 17 00:00:00 2001 From: dimka3210 Date: Sun, 5 Feb 2012 20:48:59 +0000 Subject: [PATCH] r356 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Убираем из формы восстановления пароля имя и добавляем каптчу. git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@356 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293 --- upload/config.php | 4 ++-- upload/includes/ucp/usercp_sendpasswd.php | 14 +++++--------- upload/templates/default/usercp_sendpasswd.tpl | 11 +++++++++-- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/upload/config.php b/upload/config.php index 2087f9b2d..036b3a27a 100644 --- a/upload/config.php +++ b/upload/config.php @@ -53,8 +53,8 @@ $bb_cfg = $tr_cfg = $page_cfg = array(); // Increase number of revision after update $bb_cfg['tp_version'] = '2.4 (beta)'; -$bb_cfg['tp_release_state'] = 'R355'; -$bb_cfg['tp_release_date'] = '03-02-2012'; +$bb_cfg['tp_release_state'] = 'R356'; +$bb_cfg['tp_release_date'] = '06-02-2012'; // Database $charset = 'utf8'; diff --git a/upload/includes/ucp/usercp_sendpasswd.php b/upload/includes/ucp/usercp_sendpasswd.php index cda73a79a..4e8d39727 100644 --- a/upload/includes/ucp/usercp_sendpasswd.php +++ b/upload/includes/ucp/usercp_sendpasswd.php @@ -8,15 +8,15 @@ if ( !defined('IN_PHPBB') ) if ($bb_cfg['emailer_disabled']) bb_die($lang['EMAILER_DISABLED']); +$need_captcha = ($_GET['mode'] == 'sendpassword' && !IS_ADMIN); + if ( isset($_POST['submit']) ) { - $username = ( !empty($_POST['username']) ) ? clean_username($_POST['username']) : ''; + if ($need_captcha && !CAPTCHA()->verify_code()) bb_die($lang['CONFIRM_CODE_WRONG']); $email = ( !empty($_POST['email']) ) ? trim(strip_tags(htmlspecialchars($_POST['email']))) : ''; - $sql = "SELECT * FROM " . BB_USERS . " - WHERE user_email = '" . DB()->escape($email) . "' - AND username = '" . DB()->escape($username) . "'"; + WHERE user_email = '" . DB()->escape($email)."'"; if ( $result = DB()->sql_query($sql) ) { if ( $row = DB()->sql_fetchrow($result) ) @@ -30,7 +30,6 @@ if ( isset($_POST['submit']) ) bb_die($lang['NO_SEND_ACCOUNT']); } - $username = $row['username']; $user_id = $row['user_id']; $user_actkey = make_rand_str(12); @@ -56,7 +55,6 @@ if ( isset($_POST['submit']) ) $emailer->assign_vars(array( 'SITENAME' => $bb_cfg['sitename'], - 'USERNAME' => $username, 'PASSWORD' => $user_password, 'EMAIL_SIG' => (!empty($bb_cfg['board_email_sig'])) ? str_replace('
', "\n", "-- \n" . $bb_cfg['board_email_sig']) : '', @@ -81,14 +79,12 @@ if ( isset($_POST['submit']) ) } else { - $username = ''; $email = ''; } $template->assign_vars(array( - 'USERNAME' => $username, 'EMAIL' => $email, - + 'CAPTCHA_HTML' => ($need_captcha) ? CAPTCHA()->get_html() : '', 'S_HIDDEN_FIELDS' => '', 'S_PROFILE_ACTION' => append_sid("profile.php?mode=sendpassword")) ); diff --git a/upload/templates/default/usercp_sendpasswd.tpl b/upload/templates/default/usercp_sendpasswd.tpl index 234624973..78378e001 100644 --- a/upload/templates/default/usercp_sendpasswd.tpl +++ b/upload/templates/default/usercp_sendpasswd.tpl @@ -1,3 +1,8 @@ +
@@ -13,10 +18,12 @@ {L_ITEMS_REQUIRED} + - {L_USERNAME}: * - + {L_CONFIRM_CODE}: + {CAPTCHA_HTML} + {L_EMAIL_ADDRESS}: *