mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 12:28:52 +00:00
[ticket/17414] Change handling of validate to new logic
PHPBB-17414
This commit is contained in:
parent
c382f81222
commit
589fe70be6
4 changed files with 13 additions and 21 deletions
|
@ -293,10 +293,9 @@ class ucp_register
|
||||||
|
|
||||||
if ($config['enable_confirm'])
|
if ($config['enable_confirm'])
|
||||||
{
|
{
|
||||||
$vc_response = $captcha->validate();
|
if ($captcha->validate() !== true)
|
||||||
if ($vc_response !== false)
|
|
||||||
{
|
{
|
||||||
$error[] = $vc_response;
|
$error[] = $captcha->get_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts'])
|
if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts'])
|
||||||
|
|
|
@ -176,9 +176,8 @@ class db extends base
|
||||||
// Every auth module is able to define what to do by itself...
|
// Every auth module is able to define what to do by itself...
|
||||||
if ($show_captcha)
|
if ($show_captcha)
|
||||||
{
|
{
|
||||||
$captcha->init(CONFIRM_LOGIN);
|
$captcha->init(\phpbb\captcha\plugins\plugin_interface::CONFIRM_LOGIN);
|
||||||
$vc_response = $captcha->validate();
|
if ($captcha->validate() !== true)
|
||||||
if ($vc_response)
|
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'status' => LOGIN_ERROR_ATTEMPTS,
|
'status' => LOGIN_ERROR_ATTEMPTS,
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
namespace phpbb\report\controller;
|
namespace phpbb\report\controller;
|
||||||
|
|
||||||
|
use phpbb\captcha\plugins\plugin_interface;
|
||||||
use phpbb\exception\http_exception;
|
use phpbb\exception\http_exception;
|
||||||
use phpbb\report\report_handler_interface;
|
use phpbb\report\report_handler_interface;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
|
@ -131,7 +132,7 @@ class report
|
||||||
if ($this->config['enable_post_confirm'] && !$this->user->data['is_registered'])
|
if ($this->config['enable_post_confirm'] && !$this->user->data['is_registered'])
|
||||||
{
|
{
|
||||||
$captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']);
|
$captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']);
|
||||||
$captcha->init(CONFIRM_REPORT);
|
$captcha->init(plugin_interface::CONFIRM_REPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Has the report been cancelled?
|
//Has the report been cancelled?
|
||||||
|
@ -140,7 +141,7 @@ class report
|
||||||
return new RedirectResponse($redirect_url, 302);
|
return new RedirectResponse($redirect_url, 302);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check CAPTCHA, if the form was submited
|
// Check CAPTCHA, if the form was submitted
|
||||||
if (!empty($submit) && isset($captcha))
|
if (!empty($submit) && isset($captcha))
|
||||||
{
|
{
|
||||||
$captcha_template_array = $this->check_captcha($captcha);
|
$captcha_template_array = $this->check_captcha($captcha);
|
||||||
|
@ -298,18 +299,17 @@ class report
|
||||||
/**
|
/**
|
||||||
* Check CAPTCHA
|
* Check CAPTCHA
|
||||||
*
|
*
|
||||||
* @param object $captcha A phpBB CAPTCHA object
|
* @param plugin_interface $captcha A phpBB CAPTCHA object
|
||||||
* @return array template variables which ensures that CAPTCHA's work correctly
|
* @return array template variables which ensures that CAPTCHA's work correctly
|
||||||
*/
|
*/
|
||||||
protected function check_captcha($captcha)
|
protected function check_captcha(plugin_interface $captcha)
|
||||||
{
|
{
|
||||||
$error = array();
|
$error = array();
|
||||||
$captcha_hidden_fields = '';
|
$captcha_hidden_fields = '';
|
||||||
|
|
||||||
$visual_confirmation_response = $captcha->validate();
|
if ($captcha->validate() !== true)
|
||||||
if ($visual_confirmation_response)
|
|
||||||
{
|
{
|
||||||
$error[] = $visual_confirmation_response;
|
$error[] = $captcha->get_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($error) === 0)
|
if (count($error) === 0)
|
||||||
|
|
|
@ -1210,15 +1210,9 @@ if ($submit || $preview || $refresh)
|
||||||
|
|
||||||
if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply')))
|
if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply')))
|
||||||
{
|
{
|
||||||
$captcha_data = array(
|
if ($captcha->validate() !== true)
|
||||||
'message' => $request->variable('message', '', true),
|
|
||||||
'subject' => $request->variable('subject', '', true),
|
|
||||||
'username' => $request->variable('username', '', true),
|
|
||||||
);
|
|
||||||
$vc_response = $captcha->validate($captcha_data);
|
|
||||||
if ($vc_response)
|
|
||||||
{
|
{
|
||||||
$error[] = $vc_response;
|
$error[] = $captcha->get_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue