Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1071
diff -u -9 -p -r1.1071 user.module
--- modules/user/user.module	19 Oct 2009 18:28:16 -0000	1.1071
+++ modules/user/user.module	19 Oct 2009 20:18:28 -0000
@@ -1071,19 +1071,19 @@ function user_user_presave(&$edit, $acco
 function user_user_categories() {
   return array(array(
     'name' => 'account',
     'title' => t('Account settings'),
     'weight' => 1,
   ));
 }
 
 function user_login_block($form) {
-  $form['#action'] = url($_GET['q'], array('query' => drupal_get_destination()));
+  $form['#action'] = url('user/login/redirect', array('query' => drupal_get_destination()));
   $form['#id'] = 'user-login-form';
   $form['#validate'] = user_login_default_validators();
   $form['#submit'][] = 'user_login_submit';
   $form['name'] = array('#type' => 'textfield',
     '#title' => t('Username'),
     '#maxlength' => USERNAME_MAX_LENGTH,
     '#size' => 15,
     '#required' => TRUE,
   );
@@ -1358,18 +1358,26 @@ function user_menu() {
     'file' => 'user.pages.inc',
   );
 
   $items['user/login'] = array(
     'title' => 'Log in',
     'access callback' => 'user_is_anonymous',
     'type' => MENU_DEFAULT_LOCAL_TASK,
   );
 
+  $items['user/login/redirect'] = array(
+    'title' => 'User account',
+    'page callback' => 'user_login_redirect',
+    'access callback' => 'user_is_anonymous',
+    'type' => MENU_CALLBACK,
+    'file' => 'user.pages.inc',
+  );
+
   $items['user/register'] = array(
     'title' => 'Create new account',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('user_register_form'),
     'access callback' => 'user_register_access',
     'type' => MENU_LOCAL_TASK,
   );
 
   $items['user/password'] = array(
Index: modules/user/user.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.pages.inc,v
retrieving revision 1.61
diff -u -9 -p -r1.61 user.pages.inc
--- modules/user/user.pages.inc	15 Oct 2009 16:18:46 -0000	1.61
+++ modules/user/user.pages.inc	19 Oct 2009 20:18:28 -0000
@@ -138,18 +138,30 @@ function user_pass_reset($form, &$form_s
     else {
       // Deny access, no more clues.
       // Everything will be in the watchdog's URL for the administrator to check.
       drupal_access_denied();
     }
   }
 }
 
 /**
+ * Menu callback; processes the login form and redirects to another page.
+ */
+function user_login_redirect() {
+  global $user;
+  // If the login succeeds, FAPI redirects based on $form['#redirect'];
+  // otherwise drupal_goto() redirects to the URL specified using the
+  // ?destination= parameter.
+  drupal_get_form('user_login_block');
+  drupal_goto();
+}
+
+/**
  * Menu callback; logs the current user out, and redirects to the home page.
  */
 function user_logout() {
   global $user;
 
   watchdog('user', 'Session closed for %name.', array('%name' => $user->name));
 
   module_invoke_all('user_logout', $user);
 
