Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.102 diff -u -r1.102 form.inc --- includes/form.inc 20 Apr 2006 07:11:37 -0000 1.102 +++ includes/form.inc 20 Apr 2006 09:18:42 -0000 @@ -713,6 +713,18 @@ return theme('form_element', $element['#title'], '
'. $element['#children']. '
', $element['#description'], $element['#id'], $element['#required'], form_get_error($element)); } +/* + * Expand a password_confirm field into two text boxes. + */ +function expand_password_confirm($element) { + $element['pass1'] = array('#type' => 'password', '#size' => 12, '#value' => $element['#value']['pass1']); + $element['pass2'] = array('#type' => 'password', '#size' => 12, '#value' => $element['#value']['pass2']); + $element['#validate'] = array('password_confirm_validate' => array()); + $element['#tree'] = TRUE; + + return $element; +} + /** * Validate password_confirm element. */ @@ -725,13 +737,12 @@ form_set_value($form, $pass1); if ($pass1 != $pass2) { form_error($form, t('The specified passwords do not match.')); - form_error($form['pass1']); - form_error($form['pass2']); } } elseif ($form['#required'] && !empty($_POST['edit'])) { - form_set_error('pass1', t('Password field is required.')); + form_error($form, t('Password field is required.')); } + return $form; } Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.315 diff -u -r1.315 system.module --- modules/system.module 20 Apr 2006 07:11:37 -0000 1.315 +++ modules/system.module 20 Apr 2006 09:18:43 -0000 @@ -63,12 +63,7 @@ $type['button'] = array('#input' => TRUE, '#name' => 'op', '#button_type' => 'submit', '#form_submitted' => FALSE); $type['textfield'] = array('#input' => TRUE, '#size' => 60, '#maxlength' => 128, '#autocomplete_path' => FALSE); $type['password'] = array('#input' => TRUE, '#size' => 30); - $type['password_confirm'] = array('#input' => TRUE, - '#value' => 'pass', - 'pass1' => array('#type' => 'password', '#size' => 12), - 'pass2' => array('#type' => 'password', '#size' => 12), - '#validate' => array('password_confirm_validate' => array()), - ); + $type['password_confirm'] = array('#input' => TRUE, '#process' => array('expand_password_confirm' => array())); $type['textarea'] = array('#input' => TRUE, '#cols' => 60, '#rows' => 5); $type['radios'] = array('#input' => TRUE, '#process' => array('expand_radios' => array())); $type['radio'] = array('#input' => TRUE);