added function to create random passwords
This commit is contained in:
parent
4b985473d8
commit
f074634070
|
@ -281,6 +281,21 @@ function pwd_is_enabled($hash) {
|
||||||
else return true;
|
else return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates a random password with 12 digits.
|
||||||
|
*
|
||||||
|
* @return String password
|
||||||
|
*/
|
||||||
|
function generateRandomPassword() {
|
||||||
|
$list = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_';
|
||||||
|
$password = '';
|
||||||
|
for ($i = 0; $i < 12; $i++) {
|
||||||
|
$rand = $_SESSION['ldap']->new_rand() % 65;
|
||||||
|
$password .= $list[$rand];
|
||||||
|
}
|
||||||
|
return $password;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array with all Samba 3 domain entries under the given suffix
|
* Returns an array with all Samba 3 domain entries under the given suffix
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue