25require_once DOL_DOCUMENT_ROOT.
'/core/modules/security/generate/modules_genpassword.php';
38 public $picto =
'fa-shield-alt';
64 $this->
id =
"standard";
70 $this->langs = $langs;
82 return $langs->trans(
"PasswordGenerationStandard", $this->length);
106 $possible =
"0123456789qwertyuiopasdfghjklzxcvbnmASDFGHJKLZXCVBNMQWERTYUIOP";
112 while ($i < $this->length) {
114 if (function_exists(
'random_int')) {
115 $char = substr($possible, random_int(0,
dol_strlen($possible) - 1), 1);
117 $char = substr($possible, mt_rand(0,
dol_strlen($possible) - 1), 1);
120 if (substr_count($password, $char) <= 6) {
142 $langs->load(
"other");
143 $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)