NEW Add parameter replaceambiguouschars on getRandomPassword function

This commit is contained in:
Laurent Destailleur
2018-12-21 09:56:31 +01:00
parent 44a6644969
commit 8a70cf9ede
2 changed files with 19 additions and 6 deletions

View File

@@ -260,17 +260,21 @@ class SecurityTest extends PHPUnit_Framework_TestCase
{
global $conf;
$genpass1=getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5)
$genpass1=getRandomPassword(true); // Should be a string return by dol_hash (if no option set, will be md5)
print __METHOD__." genpass1=".$genpass1."\n";
$this->assertEquals(strlen($genpass1), 32);
$genpass1=getRandomPassword(true, array('I')); // Should be a string return by dol_hash (if no option set, will be md5)
print __METHOD__." genpass1=".$genpass1."\n";
$this->assertEquals(strlen($genpass1), 32);
$conf->global->USER_PASSWORD_GENERATED='None';
$genpass2=getRandomPassword(false); // Should be an empty string
$genpass2=getRandomPassword(false); // Should return an empty string
print __METHOD__." genpass2=".$genpass2."\n";
$this->assertEquals($genpass2, '');
$conf->global->USER_PASSWORD_GENERATED='Standard';
$genpass3=getRandomPassword(false);
$genpass3=getRandomPassword(false); // Should return a password of 8 chars
print __METHOD__." genpass3=".$genpass3."\n";
$this->assertEquals(strlen($genpass3), 8);