class modGeneratePassPerso extends ModeleGenPassword (View source)

Class to generate a password according to personal rules

Properties

string $id
string $version from  ModeleGenPassword
$picto
int $WithoutAmbi

Flag to 1 if we must clean ambiguous characters for the autogeneration of password (List of ambiguous char is in $this->Ambi)

string $error from  ModeleGenPassword
DoliDB $db from  ModeleGenPassword
Conf $conf from  ModeleGenPassword
Translate $langs from  ModeleGenPassword
User $user from  ModeleGenPassword
string $length

Minimum length (text visible by end user)

from  ModeleGenPassword
int $length2

Minimum length in number of characters

from  ModeleGenPassword
string $NbMaj
string $NbNum
string $NbSpe
string $NbRepeat
string $Maj
string $Min
string $Nb
string $Spe
array<int, string> $Ambi
string $All

Methods

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(string $password)

Validate a password.

__construct($db, Conf $conf, Translate $langs, User $user)

Constructor

bool
consecutiveIterationSameCharacter($password)

Check the consecutive iterations of the same character.

Details

isEnabled()

Return if a module can be used or not

@return boolean true if module can be used

getDescription()

Return description of module

@return string Description of text

getExample()

Return an example of password generated by this module

@return string Example of password

getNewGeneratedPassword()

Build new password

@return string Return a new generated password

validatePassword(string $password)

Validate a password.

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

Parameters

string $password

Password to check @return int 0 if KO, >0 if OK

__construct($db, Conf $conf, Translate $langs, User $user)

Constructor

@param DoliDB $db Database handler

Parameters

$db
Conf $conf

Handler de conf

Translate $langs

Handler de langue

User $user

Handler du user connected

bool consecutiveIterationSameCharacter($password)

Check the consecutive iterations of the same character.

@param string $password Password to check

Parameters

$password

Return Value

bool

False if the number doesn't match the maximum consecutive value allowed.