26require_once DOL_DOCUMENT_ROOT.
'/core/modules/security/generate/modules_genpassword.php';
39 public $picto =
'fa-shield-alt';
51 $this->
id =
"standard";
57 $this->langs = $langs;
69 return $langs->trans(
"PasswordGenerationStandard", $this->length);
93 $possible =
"0123456789qwertyuiopasdfghjklzxcvbnmASDFGHJKLZXCVBNMQWERTYUIOP";
99 while ($i < $this->length) {
101 if (function_exists(
'random_int')) {
102 $char = substr($possible, random_int(0,
dol_strlen($possible) - 1), 1);
104 $char = substr($possible, mt_rand(0,
dol_strlen($possible) - 1), 1);
107 if (substr_count($password, $char) <= 6) {
129 $langs->load(
"other");
130 $this->error = $langs->trans(
"YourPasswordMustHaveAtLeastXChars", $this->length2);
Parent class for password rules/management modules.
Class to generate a password according to a dolibarr standard rule (12 random chars)
validatePassword($password)
Validate a password This function is called by User->setPassword() and internally to validate that th...
getDescription()
Return description of module.
getExample()
Return an example of password generated by this module.
getNewGeneratedPassword()
Build new password.
__construct($db, $conf, $langs, $user)
Constructor.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
conf($dolibarr_main_document_root)
Load conf file (file must exists)
$conf db user
Active Directory does not allow anonymous connections.