From 4b43f609c52a419f35650acff596dd1124d9ee3e Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Tue, 5 Feb 2008 19:33:03 +0000 Subject: [PATCH] hash passwords with SSHA --- lam/lib/modules/inetOrgPerson.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lam/lib/modules/inetOrgPerson.inc b/lam/lib/modules/inetOrgPerson.inc index 0547fce5..5ea88d78 100644 --- a/lam/lib/modules/inetOrgPerson.inc +++ b/lam/lib/modules/inetOrgPerson.inc @@ -622,7 +622,7 @@ class inetOrgPerson extends baseModule { $errors[] = $this->messages['userPassword'][1]; } else { - $this->attributes['userPassword'][0] = $_POST['userPassword']; + $this->attributes['userPassword'][0] = pwd_hash($_POST['userPassword'], true, 'SSHA'); } } } @@ -682,14 +682,14 @@ class inetOrgPerson extends baseModule { // password if (!in_array('posixAccount', $modules)) { // new account, show input fields - if ($this->getAccountContainer()->isNewAccount) { + if ($this->getAccountContainer()->isNewAccount && !isset($this->attributes['userPassword'][0])) { $return[] = array( array('kind' => 'text', 'text' => _('Password') ), - array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['userPassword'][0]), + array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '30', 'maxlength' => '255'), array('kind' => 'help', 'value' => 'userPassword')); $return[] = array( array('kind' => 'text', 'text' => _('Repeat password')), - array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['userPassword'][0]), + array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '30', 'maxlength' => '255'), array('kind' => 'text', 'text' => '')); } // old account, show button for password page @@ -865,7 +865,7 @@ class inetOrgPerson extends baseModule { $messages[] = $this->messages['userPassword'][1]; } else { - $this->attributes['userPassword'][0] = $_POST['userPassword']; + $this->attributes['userPassword'][0] = pwd_hash($_POST['userPassword'], true, 'SSHA'); } } return $messages; @@ -879,11 +879,11 @@ class inetOrgPerson extends baseModule { function display_html_password() { $return[] = array( 0 => array('kind' => 'text', 'text' => _('Password') ), - 1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ""), + 1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255'), 2 => array('kind' => 'help', 'value' => 'userPassword')); $return[] = array( 0 => array('kind' => 'text', 'text' => _('Repeat password')), - 1 => array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => "")); + 1 => array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255')); $return[] = array( 0 => array('kind' => 'table', 'value' => array( 0 => array(