From 5d159ebd002f2e16d7908c792a93454c09f4f68c Mon Sep 17 00:00:00 2001 From: NicoDucou Date: Thu, 22 Aug 2024 10:05:36 +0200 Subject: [PATCH] Script: Cron: only generate new password if user is created not if user already exist - refs BT#20351 --- tests/scripts/synchronize_user_base_from_csv.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/scripts/synchronize_user_base_from_csv.php b/tests/scripts/synchronize_user_base_from_csv.php index 0aabe07857..d6a97693f6 100644 --- a/tests/scripts/synchronize_user_base_from_csv.php +++ b/tests/scripts/synchronize_user_base_from_csv.php @@ -142,6 +142,7 @@ foreach ($accessUrls as $accessUrl) { try { + $newUser = false; $CSVuser = array_change_key_case($CSVuser); // Convert keys to lowercase if (empty($CSVuser['username'])) { @@ -160,6 +161,7 @@ foreach ($accessUrls as $accessUrl) { $dbUsers[$username] = $user; $user->setUsername($username); $user->setUsernameCanonical($username); + $newUser = true; } if ($debug) { echo 'Created ' . $username . "\n"; @@ -197,7 +199,7 @@ foreach ($accessUrls as $accessUrl) { } } - if (!$passwordSet) { + if (!$passwordSet && $newUser) { $user->setPlainPassword(api_generate_password()); }