Can set length of random password
This commit is contained in:
parent
be726c2376
commit
9e91826dea
@ -109,7 +109,7 @@ function dol_decode($chain, $key = '1')
|
||||
* @param string $chain String to hash
|
||||
* @param string $type Type of hash ('0':auto will use MAIN_SECURITY_HASH_ALGO else md5, '1':sha1, '2':sha1+md5, '3':md5, '4':md5 for OpenLdap, '5':sha256). Use '3' here, if hash is not needed for security purpose, for security need, prefer '0'.
|
||||
* @return string Hash of string
|
||||
* @getRandomPassword
|
||||
* @see getRandomPassword()
|
||||
*/
|
||||
function dol_hash($chain, $type = '0')
|
||||
{
|
||||
|
||||
@ -448,14 +448,13 @@ function encodedecode_dbpassconf($level = 0)
|
||||
* @return string New value for password
|
||||
* @see dol_hash()
|
||||
*/
|
||||
function getRandomPassword($generic = false, $replaceambiguouschars = null)
|
||||
function getRandomPassword($generic = false, $replaceambiguouschars = null, $length = 32)
|
||||
{
|
||||
global $db,$conf,$langs,$user;
|
||||
|
||||
$generated_password='';
|
||||
if ($generic)
|
||||
{
|
||||
$length = 32;
|
||||
$lowercase = "qwertyuiopasdfghjklzxcvbnm";
|
||||
$uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
|
||||
$numbers = "1234567890";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user