phpBB

Code Changes

File: phpbb/auth/provider/db.php

  Unmodified   Added   Modified   Removed
Line 14Line 14
namespace phpbb\auth\provider;

use phpbb\captcha\factory;

namespace phpbb\auth\provider;

use phpbb\captcha\factory;

 
use phpbb\captcha\plugins\captcha_abstract;

use phpbb\config\config;
use phpbb\db\driver\driver_interface;
use phpbb\passwords\manager;

use phpbb\config\config;
use phpbb\db\driver\driver_interface;
use phpbb\passwords\manager;

Line 149Line 150
		else
{
$attempts = 0;

		else
{
$attempts = 0;

 
		}

$login_error_attempts = 'LOGIN_ERROR_ATTEMPTS';

$user_login_attempts = (is_array($row) && $this->config['max_login_attempts'] && $row['user_login_attempts'] >= $this->config['max_login_attempts']);
$ip_login_attempts = ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']);

$show_captcha = $user_login_attempts || $ip_login_attempts;

if ($show_captcha)
{
$captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']);

// Get custom message for login error when exceeding maximum number of attempts
if ($captcha instanceof captcha_abstract)
{
$login_error_attempts = $captcha->get_login_error_attempts();
}

		}

if (!$row)

		}

if (!$row)

Line 157Line 176
			{
return array(
'status' => LOGIN_ERROR_ATTEMPTS,

			{
return array(
'status' => LOGIN_ERROR_ATTEMPTS,

					'error_msg'		=> 'LOGIN_ERROR_ATTEMPTS',

					'error_msg'		=> $login_error_attempts,

					'user_row'		=> array('user_id' => ANONYMOUS),
);
}

					'user_row'		=> array('user_id' => ANONYMOUS),
);
}

Line 168Line 187
				'user_row'	=> array('user_id' => ANONYMOUS),
);
}

				'user_row'	=> array('user_id' => ANONYMOUS),
);
}


$show_captcha = ($this->config['max_login_attempts'] && $row['user_login_attempts'] >= $this->config['max_login_attempts']) ||
($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']);

 

// If there are too many login attempts, we need to check for a confirm image
// Every auth module is able to define what to do by itself...
if ($show_captcha)
{


// If there are too many login attempts, we need to check for a confirm image
// Every auth module is able to define what to do by itself...
if ($show_captcha)
{

			$captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']);

 
			$captcha->init(CONFIRM_LOGIN);
$vc_response = $captcha->validate($row);
if ($vc_response)
{
return array(
'status' => LOGIN_ERROR_ATTEMPTS,

			$captcha->init(CONFIRM_LOGIN);
$vc_response = $captcha->validate($row);
if ($vc_response)
{
return array(
'status' => LOGIN_ERROR_ATTEMPTS,

					'error_msg'		=> 'LOGIN_ERROR_ATTEMPTS',

					'error_msg'		=> $login_error_attempts,

					'user_row'		=> $row,
);
}

					'user_row'		=> $row,
);
}