Inform the user when cookies are disabled and login fails. Fixed #2039 props tellyworth.

git-svn-id: http://svn.automattic.com/wordpress/trunk@6009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
westi 2007-09-02 17:20:37 +00:00
parent 7e45ed193a
commit 2662be2098
2 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,8 @@ if ( defined('RELOCATE') ) { // Move flag is set
update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) ); 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 // Rather than duplicating this HTML all over the place, we'll stick it in function
function login_header($title = 'Login', $message = '') { function login_header($title = 'Login', $message = '') {
@ -307,6 +309,10 @@ default:
do_action_ref_array('wp_authenticate', array(&$user_login, &$user_pass)); 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'] = __('<strong>ERROR</strong>: WordPress requires Cookies but your browser does not support them or they are blocked.');
if ( $user_login && $user_pass && empty( $errors ) ) { if ( $user_login && $user_pass && empty( $errors ) ) {
$user = new WP_User(0, $user_login); $user = new WP_User(0, $user_login);

View File

@ -206,6 +206,8 @@ if ( !defined('USER_COOKIE') )
define('USER_COOKIE', 'wordpressuser_'. COOKIEHASH); define('USER_COOKIE', 'wordpressuser_'. COOKIEHASH);
if ( !defined('PASS_COOKIE') ) if ( !defined('PASS_COOKIE') )
define('PASS_COOKIE', 'wordpresspass_'. COOKIEHASH); define('PASS_COOKIE', 'wordpresspass_'. COOKIEHASH);
if ( !defined('TEST_COOKIE') )
define('TEST_COOKIE', 'wordpress_test_cookie');
if ( !defined('COOKIEPATH') ) if ( !defined('COOKIEPATH') )
define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
if ( !defined('SITECOOKIEPATH') ) if ( !defined('SITECOOKIEPATH') )