summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module16
1 files changed, 5 insertions, 11 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index d38de69b1..c33aa0982 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1308,12 +1308,10 @@ function user_user_presave(&$edit, $account, $category) {
elseif (!empty($edit['picture_delete'])) {
$edit['picture'] = NULL;
}
- }
-
- // Filter out roles with empty values to avoid granting extra roles when
- // processing custom form submissions.
- if (isset($edit['roles'])) {
- $edit['roles'] = array_filter($edit['roles']);
+ // Prepare user roles.
+ if (isset($edit['roles'])) {
+ $edit['roles'] = array_filter($edit['roles']);
+ }
}
// Move account cancellation information into $user->data.
@@ -2229,11 +2227,7 @@ function user_login_final_validate($form, &$form_state) {
}
}
else {
- // Use $form_state['input']['name'] here to guarantee that we send
- // exactly what the user typed in. $form_state['values']['name'] may have
- // been modified by validation handlers that ran earlier than this one.
- $query = isset($form_state['input']['name']) ? array('name' => $form_state['input']['name']) : array();
- form_set_error('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => url('user/password', array('query' => $query)))));
+ form_set_error('name', t('Sorry, unrecognized username or password. <a href="@password">Have you forgotten your password?</a>', array('@password' => url('user/password', array('query' => array('name' => $form_state['values']['name']))))));
watchdog('user', 'Login attempt failed for %user.', array('%user' => $form_state['values']['name']));
}
}