Skip to content
Snippets Groups Projects
Verified Commit c397a465 authored by Florian Azizian's avatar Florian Azizian
Browse files

FEAT #12162 TIME 0:30 generate random password

parent f76e9138
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,14 @@ abstract class UserModelAbstract
ValidatorModel::notEmpty($aArgs['user'], ['userId', 'firstname', 'lastname']);
ValidatorModel::stringType($aArgs['user'], ['userId', 'firstname', 'lastname', 'mail', 'initials', 'phone', 'changePassword', 'loginmode']);
$length = rand(50, 70);
$chars = '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcefghijklmnopqrstuvwxyz!@$%^*_=+,.?';
$count = mb_strlen($chars);
for ($i = 0, $password = ''; $i < $length; $i++) {
$index = rand(0, $count - 1);
$password .= mb_substr($chars, $index, 1);
}
DatabaseModel::insert([
'table' => 'users',
'columnsValues' => [
......@@ -95,7 +103,7 @@ abstract class UserModelAbstract
'status' => 'OK',
'change_password' => empty($aArgs['user']['changePassword']) ? 'Y' : $aArgs['user']['changePassword'],
'loginmode' => empty($aArgs['user']['loginmode']) ? 'standard' : $aArgs['user']['loginmode'],
'password' => AuthenticationModel::getPasswordHash('maarch'),
'password' => AuthenticationModel::getPasswordHash($password),
'password_modification_date' => 'CURRENT_TIMESTAMP'
]
]);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment