From 33306a06998233f18b85542f70cfbe9f2e648e3b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 21 Jun 2020 10:44:27 +0200 Subject: [PATCH] [ticket/16534] Add conversion prefix to all passwords that need conversion PHPBB3-16534 --- .../db/migration/data/v310/passwords_convert_p1.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php b/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php index 295f2d2a14..33ffb7cdd1 100644 --- a/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php +++ b/phpBB/phpbb/db/migration/data/v310/passwords_convert_p1.php @@ -27,6 +27,12 @@ class passwords_convert_p1 extends \phpbb\db\migration\migration ); } + /** + * Update passwords with convert flag to have $CP$ prefix + * + * @param int $start Limit start value + * @return int|void Null if conversion is finished, next start value if not + */ public function update_passwords($start) { // Nothing to do if user_pass_convert column doesn't exist @@ -51,8 +57,8 @@ class passwords_convert_p1 extends \phpbb\db\migration\migration $converted_users++; $user_id = (int) $row['user_id']; - // Only prefix passwords without proper prefix - if (!isset($update_users[$user_id]) && !preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $row['user_password'])) + // Prefix all passwords that need to be converted + if (!isset($update_users[$user_id])) { // Use $CP$ prefix for passwords that need to // be converted and set pass convert to false.