In wp-login.php check if cookies are enabled before attempting to log the user in with wp_signon(), fixes #24961.

Built from https://develop.svn.wordpress.org/trunk@25045


git-svn-id: http://core.svn.wordpress.org/trunk@25032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-08-17 01:01:09 +00:00
parent cd0642bdc7
commit 29739b2508
1 changed files with 5 additions and 5 deletions

View File

@ -619,7 +619,11 @@ default:
if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
$secure_cookie = false;
$user = wp_signon('', $secure_cookie);
// If cookies are disabled we can't log in even with a valid user+pass
if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
$user = new WP_Error('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
else
$user = wp_signon('', $secure_cookie);
$redirect_to = apply_filters('login_redirect', $redirect_to, isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '', $user);
@ -655,10 +659,6 @@ default:
if ( !empty($_GET['loggedout']) || $reauth )
$errors = new WP_Error();
// If cookies are disabled we can't log in even with a valid user+pass
if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
$errors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
if ( $interim_login ) {
if ( ! $errors->get_error_code() )
$errors->add('expired', __('Session expired. Please log in again. You will not move away from this page.'), 'message');