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);
Parent class for password rules/management modules.
conf($dolibarr_main_document_root)
Load conf file (file must exists)
$conf db
API class for accounts.
__construct($db, $conf, $langs, $user)
Constructor.
validatePassword($password)
Validate a password This function is called by User->setPassword() and internally to validate that th...
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
getNewGeneratedPassword()
Build new password.
Class to generate a password according to a dolibarr standard rule (12 random chars) ...
getExample()
Return an example of password generated by this module.
getDescription()
Return description of module.