random passwords

This commit is contained in:
Roland Gruber 2007-11-18 12:54:09 +00:00
parent 6eaf3af9fd
commit 14cdf2ed44
2 changed files with 17 additions and 1 deletions

View File

@ -5,6 +5,7 @@
- Security: passwords in configuration files are now saved as hash values
- style fixes for Internet Explorer users
- Unix: allow to set host passwords (RFE 1754069)
- Unix: allow to generate random passwords for users
- Samba 3 groups: Samba part is now optional
- Personal: add object classes person and organizationalPerson for new accounts (RFE 1830033)

View File

@ -894,6 +894,12 @@ class posixAccount extends baseModule {
*/
function process_password() {
if ($_POST['form_subpage_posixAccount_attributes_back']) return array();
else if ($_POST['form_subpage_posixAccount_attributes_randomPassword']) {
$pwd = generateRandomPassword();
$this->clearTextPassword = $pwd;
$this->attributes['userPassword'][0] = pwd_hash($pwd, true, $this->moduleSettings['posixAccount_pwdHash'][0]);
return array(array('INFO', 'The password was set to:' . ' ' . $pwd));
}
$errors = array();
if ($_POST['userPassword'] != $_POST['userPassword2']) {
$errors[] = $this->messages['userPassword'][0];
@ -1089,12 +1095,21 @@ class posixAccount extends baseModule {
$return[] = array(
array('kind' => 'text', 'text' => _('Repeat password')),
array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ""));
$return[] = array(
array('kind' => 'text', 'text' => ' ')
);
$return[] = array(
array('kind' => 'text', 'text' => ' ')
);
$return[] = array(
array('kind' => 'table', 'value' => array(
array(
array('kind' => 'input', 'type' => 'submit', 'value' => _('Ok'), 'name' => 'form_subpage_posixAccount_attributes_submit'),
array('kind' => 'input', 'type' => 'submit', 'value' => _('Cancel'), 'name' => 'form_subpage_posixAccount_attributes_back'),
array('kind' => 'text')))));
array('kind' => 'text')))),
array('kind' => 'input', 'type' => 'submit', 'value' => _('Set random password'),
'name' => 'form_subpage_posixAccount_attributes_randomPassword', 'td' => array('align' => 'right', 'colspan' => 2))
);
return $return;
}