25 require_once DOL_DOCUMENT_ROOT.
'/core/modules/security/generate/modules_genpassword.php';
72 $this->
id =
"standard";
78 $this->langs = $langs;
90 return $langs->trans(
"PasswordGenerationStandard", $this->length);
114 $possible =
"0123456789qwertyuiopasdfghjklzxcvbnmASDFGHJKLZXCVBNMQWERTYUIOP";
120 while ($i < $this->length) {
122 if (function_exists(
'random_int')) {
123 $char = substr($possible, random_int(0,
dol_strlen($possible) - 1), 1);
125 $char = substr($possible, mt_rand(0,
dol_strlen($possible) - 1), 1);
128 if (substr_count($password, $char) <= 6) {
150 $langs->load(
"other");
151 $this->error = $langs->trans(
"YourPasswordMustHaveAtLeastXChars", $this->length2);