diff --git a/wp-login.php b/wp-login.php index 61bfe67450..948dddd656 100644 --- a/wp-login.php +++ b/wp-login.php @@ -20,6 +20,8 @@ if ( defined('RELOCATE') ) { // Move flag is set update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) ); } +//Set a cookie now to see if they are supported by the browser. +setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN); // Rather than duplicating this HTML all over the place, we'll stick it in function function login_header($title = 'Login', $message = '') { @@ -307,6 +309,10 @@ default: do_action_ref_array('wp_authenticate', array(&$user_login, &$user_pass)); + // If cookies are disabled we can't log in even with a valid user+pass + if ( $_POST && empty($_COOKIE[TEST_COOKIE]) ) + $errors['test_cookie'] = __('ERROR: WordPress requires Cookies but your browser does not support them or they are blocked.'); + if ( $user_login && $user_pass && empty( $errors ) ) { $user = new WP_User(0, $user_login); diff --git a/wp-settings.php b/wp-settings.php index 7879ff1538..c4f918c135 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -206,6 +206,8 @@ if ( !defined('USER_COOKIE') ) define('USER_COOKIE', 'wordpressuser_'. COOKIEHASH); if ( !defined('PASS_COOKIE') ) define('PASS_COOKIE', 'wordpresspass_'. COOKIEHASH); +if ( !defined('TEST_COOKIE') ) + define('TEST_COOKIE', 'wordpress_test_cookie'); if ( !defined('COOKIEPATH') ) define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); if ( !defined('SITECOOKIEPATH') )