1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-18 14:31:19 +02:00

[feature/passwords] Inject passwords manager into auth providers

The passwords manager will replace the old method of using the functions
phpbb_hash() and phpbb_check_hash().

PHPBB3-11610
This commit is contained in:
Marc Alexander
2013-10-02 13:28:38 +02:00
parent 61e4c0f251
commit 356f3eef07
6 changed files with 82 additions and 20 deletions

View File

@@ -26,17 +26,26 @@ if (!defined('IN_PHPBB'))
*/
class ldap extends \phpbb\auth\provider\base
{
/**
* phpBB passwords manager
*
* @var \phpbb\passwords\manager
*/
protected $passwords_manager;
/**
* LDAP Authentication Constructor
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\config\config $config
* @param \phpbb\user $user
* @param \phpbb\db\driver\driver $db
* @param \phpbb\config\config $config
* @param \phpbb\passwords\manager $passwords_manager
* @param \phpbb\user $user
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\user $user)
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user)
{
$this->db = $db;
$this->config = $config;
$this->passwords_manager = $passwords_manager;
$this->user = $user;
}
@@ -244,7 +253,7 @@ class ldap extends \phpbb\auth\provider\base
// generate user account data
$ldap_user_row = array(
'username' => $username,
'user_password' => phpbb_hash($password),
'user_password' => $this->passwords_manager->hash($password),
'user_email' => (!empty($this->config['ldap_email'])) ? utf8_htmlspecialchars($ldap_result[0][htmlspecialchars_decode($this->config['ldap_email'])][0]) : '',
'group_id' => (int) $row['group_id'],
'user_type' => USER_NORMAL,