From 3572f4c92ef554860262dbd953953cafb3af2ebc Mon Sep 17 00:00:00 2001 From: Richard McGirr Date: Sun, 8 May 2016 08:50:06 -0400 Subject: [PATCH 1/3] [ticket/14610] Don't log an error if the Q&A captcha has been solved https://tracker.phpbb.com/browse/PHPBB3-14610 PHPBB3-14610 --- phpBB/phpbb/captcha/plugins/qa.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 8f2da838c5..5b63cf53b8 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -224,6 +224,11 @@ class qa if ($this->is_solved() || empty($this->question_text) || !count($this->question_ids)) { + // don't log an error if the captcha has been solved + if ($this->is_solved()) + { + return; + } /** @var \phpbb\log\log_interface $phpbb_log */ $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); return false; From f57f09f814f7faadf232625e2185a12fe0e503c6 Mon Sep 17 00:00:00 2001 From: Richard McGirr Date: Sun, 8 May 2016 09:24:11 -0400 Subject: [PATCH 2/3] [ticket/14610] Remove whitespace PHPBB3-14610 --- phpBB/phpbb/captcha/plugins/qa.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 5b63cf53b8..7dc3ef796f 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -228,7 +228,7 @@ class qa if ($this->is_solved()) { return; - } + } /** @var \phpbb\log\log_interface $phpbb_log */ $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); return false; From 03348087d8bf8794da257f6e7ac4e318dd562fc0 Mon Sep 17 00:00:00 2001 From: Richard McGirr Date: Mon, 9 May 2016 17:00:16 -0400 Subject: [PATCH 3/3] [ticket/14610] Implement lavigor method PHPBB3-14610 --- phpBB/phpbb/captcha/plugins/qa.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/phpBB/phpbb/captcha/plugins/qa.php b/phpBB/phpbb/captcha/plugins/qa.php index 7dc3ef796f..a9d133d8f2 100644 --- a/phpBB/phpbb/captcha/plugins/qa.php +++ b/phpBB/phpbb/captcha/plugins/qa.php @@ -222,13 +222,12 @@ class qa { global $phpbb_log, $template, $user; - if ($this->is_solved() || empty($this->question_text) || !count($this->question_ids)) + if ($this->is_solved()) + { + return false; + } + else if (empty($this->question_text) || !count($this->question_ids)) { - // don't log an error if the captcha has been solved - if ($this->is_solved()) - { - return; - } /** @var \phpbb\log\log_interface $phpbb_log */ $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); return false; @@ -236,10 +235,10 @@ class qa else { $template->assign_vars(array( - 'QA_CONFIRM_QUESTION' => $this->question_text, - 'QA_CONFIRM_ID' => $this->confirm_id, - 'S_CONFIRM_CODE' => true, - 'S_TYPE' => $this->type, + 'QA_CONFIRM_QUESTION' => $this->question_text, + 'QA_CONFIRM_ID' => $this->confirm_id, + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, )); return 'captcha_qa.html';