dolibarr 25.0.0-alpha
ModeleGenPassword Class Reference

Parent class for password rules/management modules. More...

Inheritance diagram for ModeleGenPassword:

Public Member Functions

 isEnabled ()
 Return if a module can be used or not.
 
 getDescription ()
 Return description of module.
 
 getExample ()
 Return an example of password generated by this module.
 
 getNewGeneratedPassword ()
 Build new password.
 
 validatePassword ($password)
 Validate a password.
 

Static Public Member Functions

static loadAndInstantiate ($id, $db, $conf, $langs, $user)
 Locate, load and instantiate a password generator/validator model by its id (the value stored in USER_PASSWORD_GENERATED, e.g.
 

Detailed Description

Parent class for password rules/management modules.

Definition at line 31 of file modules_genpassword.php.

Member Function Documentation

◆ getDescription()

ModeleGenPassword::getDescription ( )

Return description of module.

Returns
string Description of text

Reimplemented in modGeneratePassNone, modGeneratePassPerso, and modGeneratePassStandard.

Definition at line 109 of file modules_genpassword.php.

◆ getExample()

ModeleGenPassword::getExample ( )

Return an example of password generated by this module.

Returns
string Example of password

Reimplemented in modGeneratePassNone, modGeneratePassPerso, and modGeneratePassStandard.

Definition at line 120 of file modules_genpassword.php.

◆ getNewGeneratedPassword()

ModeleGenPassword::getNewGeneratedPassword ( )

Build new password.

Returns
string Return a new generated password

Reimplemented in modGeneratePassNone, modGeneratePassPerso, and modGeneratePassStandard.

Definition at line 132 of file modules_genpassword.php.

◆ isEnabled()

ModeleGenPassword::isEnabled ( )

Return if a module can be used or not.

Returns
boolean true if module can be used

Definition at line 99 of file modules_genpassword.php.

◆ loadAndInstantiate()

static ModeleGenPassword::loadAndInstantiate ( $id,
$db,
$conf,
$langs,
$user )
static

Locate, load and instantiate a password generator/validator model by its id (the value stored in USER_PASSWORD_GENERATED, e.g.

'standard', 'PasswordGuard'). Scans core/modules/security/generate/ plus, for each enabled module declaring module_parts['models'], its own core/modules/security/generate/ subdirectory — the same multi-root convention used by every numbering-module scan in Dolibarr (see e.g. Facture\getNextNumRef()). This lets a module contribute its own modGeneratePassXxx class from its own directory without any further core patch.

Parameters
string$idGenerator id (value of USER_PASSWORD_GENERATED), e.g. 'standard', 'PasswordGuard'
DoliDB$dbDatabase handler
Conf$confHandler de conf
Translate$langsHandler de langue
User$userHandler du user connected
Returns
?ModeleGenPassword The instantiated generator, or null if no matching class was found

Definition at line 166 of file modules_genpassword.php.

References dol_buildpath().

Referenced by FormSetupItem\generateInputFieldPassword(), getRandomPassword(), User\setPassword(), and PasswordField\verifyFieldValue().

◆ validatePassword()

ModeleGenPassword::validatePassword ( $password)

Validate a password.

This function is called by User->setPassword() and internally to validate that the password matches the constraints.

Parameters
string$passwordPassword to check
Returns
int 0 if KO, >0 if OK

Reimplemented in modGeneratePassNone, modGeneratePassPerso, and modGeneratePassStandard.

Definition at line 145 of file modules_genpassword.php.


The documentation for this class was generated from the following file: