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

git-svn-id: https://develop.svn.wordpress.org/trunk@6009 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2007-09-02 17:20:37 +00:00
parent d0d887d09d
commit 187574db35
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']) );
}
//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'] = __('<strong>ERROR</strong>: 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);

View File

@ -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') )