From 83cd31cd760232864cec3878cce65bfe4b0420f0 Mon Sep 17 00:00:00 2001 From: Gerhard Killesreiter Date: Tue, 25 Apr 2006 20:44:00 +0000 Subject: #60267, user password get lost if editing user account, patch by Jaza --- includes/form.inc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'includes') diff --git a/includes/form.inc b/includes/form.inc index 07df6d782..a6fd96536 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -727,12 +727,9 @@ function expand_password_confirm($element) { * Validate password_confirm element. */ function password_confirm_validate($form) { - if (!empty($form['pass1']['#value'])) { - $pass1 = trim($form['pass1']['#value']); + $pass1 = trim($form['pass1']['#value']); + if (!empty($pass1)) { $pass2 = trim($form['pass2']['#value']); - form_set_value($form['pass1'], NULL); - form_set_value($form['pass2'], NULL); - form_set_value($form, $pass1); if ($pass1 != $pass2) { form_error($form, t('The specified passwords do not match.')); } @@ -741,6 +738,12 @@ function password_confirm_validate($form) { form_error($form, t('Password field is required.')); } + // Password field must be converted from a two-element array into a single + // string regardless of validation results. + form_set_value($form['pass1'], NULL); + form_set_value($form['pass2'], NULL); + form_set_value($form, $pass1); + return $form; } -- cgit v1.2.3