Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1039
diff -u -9 -p -r1.1039 user.module
--- modules/user/user.module	5 Sep 2009 05:45:45 -0000	1.1039
+++ modules/user/user.module	5 Sep 2009 10:54:54 -0000
@@ -955,19 +955,19 @@ function user_user_categories() {
   return array(array(
     'name' => 'account',
     'title' => t('Account settings'),
     'weight' => 1,
   ));
 }
 
 function user_login_block() {
   $form = array(
-    '#action' => url($_GET['q'], array('query' => drupal_get_destination())),
+    '#action' => url('user/login/redirect', array('query' => drupal_get_destination())),
     '#id' => 'user-login-form',
     '#validate' => user_login_default_validators(),
     '#submit' => array('user_login_submit'),
   );
   $form['name'] = array('#type' => 'textfield',
     '#title' => t('Username'),
     '#maxlength' => USERNAME_MAX_LENGTH,
     '#size' => 15,
     '#required' => TRUE,
@@ -1254,18 +1254,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'),
     '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.50
diff -u -9 -p -r1.50 user.pages.inc
--- modules/user/user.pages.inc	31 Aug 2009 18:18:44 -0000	1.50
+++ modules/user/user.pages.inc	5 Sep 2009 10:54:54 -0000
@@ -138,18 +138,30 @@ function user_pass_reset(&$form_state, $
     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);
 
