Created
December 30, 2025 09:02
-
-
Save Feiron/066f189fb5b9ba920d81799dbd85ec71 to your computer and use it in GitHub Desktop.
[Смена паролей пользователей] так же они сразу разлогиниваются #bitrix#utils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $arFilter = ['ACTIVE' => 'Y']; | |
| $dbUsers = \Bitrix\Main\UserTable::getList(['filter' => $arFilter]); | |
| echo '<pre>'; | |
| var_dump($dbUsers->getSelectedRowsCount()); | |
| echo '</pre>'; | |
| foreach ($dbUsers as $arUser) { | |
| $userId = $arUser['ID']; | |
| if($userId == 326){ | |
| //echo '<pre>'; var_dump('Скип себя'); echo '</pre>'; | |
| continue; | |
| } | |
| $password = \CUser::GeneratePasswordByPolicy([11]); | |
| $user = new \CUser(); | |
| $fields = [ | |
| "PASSWORD" => $password, | |
| "CONFIRM_PASSWORD" => $password | |
| ]; | |
| $user->Update($userId, $fields); | |
| echo implode(' ', [$arUser['LOGIN'], $password]); | |
| echo '<br>'; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment