diff options
Diffstat (limited to 'modules/user/user.module')
-rw-r--r-- | modules/user/user.module | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/user/user.module b/modules/user/user.module index 00046b6cf7a..8b5a37789f5 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -670,8 +670,15 @@ function user_user($type, &$edit, &$account, $category = NULL) { return _user_edit_validate((isset($account->uid) ? $account->uid : FALSE), $edit); } - if ($type == 'submit' && $category == 'account') { - return _user_edit_submit((isset($account->uid) ? $account->uid : FALSE), $edit); + if ($type == 'submit') { + if ($category == 'account') { + return _user_edit_submit((isset($account->uid) ? $account->uid : FALSE), $edit); + } + elseif (isset($edit['roles'])) { + // Filter out roles with empty values to avoid granting extra roles when + // processing custom form submissions. + $edit['roles'] = array_filter($edit['roles']); + } } if ($type == 'categories') { @@ -681,7 +688,7 @@ function user_user($type, &$edit, &$account, $category = NULL) { function user_login_block() { $form = array( - '#action' => url($_GET['q'], array('query' => drupal_get_destination())), + '#action' => url($_GET['q'], array('query' => drupal_get_destination(), 'external' => FALSE)), '#id' => 'user-login-form', '#validate' => user_login_default_validators(), '#submit' => array('user_login_submit'), |