diff --git a/lam/HISTORY b/lam/HISTORY index dfe59179..4bf6258d 100644 --- a/lam/HISTORY +++ b/lam/HISTORY @@ -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) diff --git a/lam/lib/modules/posixAccount.inc b/lam/lib/modules/posixAccount.inc index 558a57f1..a9a7bb86 100644 --- a/lam/lib/modules/posixAccount.inc +++ b/lam/lib/modules/posixAccount.inc @@ -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; }