summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
authorGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-04-25 20:44:00 +0000
committerGerhard Killesreiter <killes_www_drop_org@227.no-reply.drupal.org>2006-04-25 20:44:00 +0000
commit83cd31cd760232864cec3878cce65bfe4b0420f0 (patch)
treec24a39d495b8762de78a4e7be0826eeb08468da9 /includes/form.inc
parent8dfca7c806eead73a47f4275db4d4e3bfb27356b (diff)
downloadbrdo-83cd31cd760232864cec3878cce65bfe4b0420f0.tar.gz
brdo-83cd31cd760232864cec3878cce65bfe4b0420f0.tar.bz2
#60267, user password get lost if editing user account, patch by Jaza
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc13
1 files changed, 8 insertions, 5 deletions
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;
}