Script: Cron: only generate new password if user is created not if user already exist - refs BT#20351

pull/5748/head
NicoDucou 3 months ago
parent 596ef217f7
commit 5d159ebd00
  1. 4
      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());
}

Loading…
Cancel
Save