=== modified file 'includes/session.inc'
--- includes/session.inc	2007-12-22 23:24:24 +0000
+++ includes/session.inc	2008-01-02 15:52:16 +0000
@@ -24,6 +24,7 @@ function sess_read($key) {
 
   // Handle the case of first time visitors and clients that don't store cookies (eg. web crawlers).
   if (!isset($_COOKIE[session_name()])) {
+    setcookie('drupal_login_check', TRUE, time() + 31536000, '/');
     $user = drupal_anonymous_user();
     return '';
   }
@@ -47,6 +48,7 @@ function sess_read($key) {
   // We didn't find the client's record (session has expired), or they are an anonymous user.
   else {
     $session = isset($user->session) ? $user->session : '';
+    setcookie('drupal_login_check', TRUE, time() + 31536000, '/');
     $user = drupal_anonymous_user($session);
   }
 

=== modified file 'modules/user/user.module'
--- modules/user/user.module	2007-12-28 12:02:49 +0000
+++ modules/user/user.module	2008-01-02 15:07:01 +0000
@@ -74,6 +74,10 @@ function user_theme() {
     'user_signature' => array(
       'arguments' => array('signature' => NULL),
     ),
+    'user_no_cookie' => array(
+      'file' => 'user.pages.inc',
+      'arguments' => array('domain' => NULL),
+    ),
   );
 }
 
@@ -905,6 +909,13 @@ function user_menu() {
     'type' => MENU_LOCAL_TASK,
     'file' => 'user.pages.inc',
   );
+  $items['user/no-cookie'] = array(
+    'title' => 'Please enable cookies',
+    'page callback' => 'user_no_cookie',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+    'file' => 'user.pages.inc',
+  );
   $items['user/reset/%/%/%'] = array(
     'title' => 'Reset password',
     'page callback' => 'drupal_get_form',
@@ -1338,15 +1349,20 @@ function user_authenticate_finalize(&$ed
 }
 
 /**
- * A validate handler on the login form. Update user's login timestamp, fire
+ * A submit handler on the login form. Update user's login timestamp, fire
  * hook_user('login), and generate new session ID.
  */
 function user_login_submit($form, &$form_state) {
   global $user;
   if ($user->uid) {
     $form_state['redirect'] = 'user/'. $user->uid;
-    return;
   }
+  if (!isset($_COOKIE['drupal_login_check'])) {
+    unset($_REQUEST['destination']);
+    drupal_goto('user/no-cookie');
+  }
+  // Set some time in the past, I used the value for the Expires header.
+  setcookie('drupal_login_check', TRUE, 280299600, '/', ini_get('session.cookie_domain'));
 }
 
 /**

=== modified file 'modules/user/user.pages.inc'
--- modules/user/user.pages.inc	2008-01-02 12:57:37 +0000
+++ modules/user/user.pages.inc	2008-01-02 15:59:58 +0000
@@ -363,3 +363,11 @@ function user_page() {
     return drupal_get_form('user_login');
   }
 }
+
+function user_no_cookie() {
+  return theme('user_no_cookie', ini_get('session.cookie_domain'));
+}
+
+function theme_user_no_cookie($domain) {
+  return t('It seems that your browser does not accept cookies. To log into this site, you need to accept cookies from the domain @domain.', array('@domain' => $domain));
+}

