phpBB

Code Changes

File: phpbb/console/command/fixup/update_hashes.php

  Unmodified   Added   Modified   Removed
Line 100Line 100
		while ($row = $this->db->sql_fetchrow($result))
{
$old_hash = preg_replace('/^\$CP\$/', '', $row['user_password']);

		while ($row = $this->db->sql_fetchrow($result))
{
$old_hash = preg_replace('/^\$CP\$/', '', $row['user_password']);

			$new_hash = $this->passwords_manager->hash($old_hash, array($this->default_type));










// If stored hash type is unknown then it's md5 hash with no prefix
// First rehash it using $H$ as hash type identifier (salted_md5)
if (!$this->passwords_manager->detect_algorithm($old_hash))
{
$old_hash = $this->passwords_manager->hash($old_hash, '$H$');
}

$new_hash = $this->passwords_manager->hash($old_hash, [$this->default_type]);


$sql = 'UPDATE ' . USERS_TABLE . "
SET user_password = '" . $this->db->sql_escape($new_hash) . "'


$sql = 'UPDATE ' . USERS_TABLE . "
SET user_password = '" . $this->db->sql_escape($new_hash) . "'