X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/baca9ce86a38dc54c4574890ee2d352fd81f78b2..e3ff8f35458a959c1879c0a4976701ed8dcfe651:/wp-login.php diff --git a/wp-login.php b/wp-login.php index 209341fa..4e189d86 100644 --- a/wp-login.php +++ b/wp-login.php @@ -23,85 +23,154 @@ if ( force_ssl_admin() && ! is_ssl() ) { } /** - * Outputs the header for the login page. + * Output the login page header. * - * @uses do_action() Calls the 'login_head' for outputting HTML in the Log In - * header. - * @uses apply_filters() Calls 'login_headerurl' for the top login link. - * @uses apply_filters() Calls 'login_headertitle' for the top login title. - * @uses apply_filters() Calls 'login_message' on the message to display in the - * header. - * @uses $error The error global, which is checked for displaying errors. - * - * @param string $title Optional. WordPress Log In Page title to display in - *
-
- - + @@ -632,7 +834,10 @@ default: elseif ( is_multisite() && !$user->has_cap('read') ) $redirect_to = get_dashboard_url( $user->ID ); elseif ( !$user->has_cap('edit_posts') ) - $redirect_to = admin_url('profile.php'); + $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); + + wp_redirect( $redirect_to ); + exit(); } wp_safe_redirect($redirect_to); exit(); @@ -643,25 +848,34 @@ 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', __("ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.")); - - // Some parts of this script use the main login form to display a message - if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] ) - $errors->add('loggedout', __('You are now logged out.'), 'message'); - elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) - $errors->add('registerdisabled', __('User registration is currently not allowed.')); - elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) - $errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message'); - elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) - $errors->add('newpass', __('Check your e-mail for your new password.'), 'message'); - elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) - $errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message'); - elseif ( $interim_login ) - $errors->add('expired', __('Your session has expired. Please log-in again.'), 'message'); - elseif ( strpos( $redirect_to, 'about.php?updated' ) ) - $errors->add('updated', __( 'You have successfully updated WordPress! Please log back in to experience the awesomeness.' ), 'message' ); + if ( $interim_login ) { + if ( ! $errors->get_error_code() ) + $errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' ); + } else { + // Some parts of this script use the main login form to display a message + if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] ) + $errors->add('loggedout', __('You are now logged out.'), 'message'); + elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) + $errors->add('registerdisabled', __('User registration is currently not allowed.')); + elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] ) + $errors->add('confirm', __('Check your email for the confirmation link.'), 'message'); + elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] ) + $errors->add('newpass', __('Check your email for your new password.'), 'message'); + elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] ) + $errors->add('registered', __('Registration complete. Please check your email.'), 'message'); + elseif ( strpos( $redirect_to, 'about.php?updated' ) ) + $errors->add('updated', __( 'You have successfully updated WordPress! Please log back in to see what’s new.' ), 'message' ); + } + + /** + * Filters the login page errors. + * + * @since 3.6.0 + * + * @param object $errors WP Error object. + * @param string $redirect_to Redirect destination URL. + */ + $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); // Clear any stale cookies. if ( $reauth ) @@ -670,21 +884,34 @@ default: login_header(__('Log In'), '', $errors); if ( isset($_POST['log']) ) - $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(stripslashes($_POST['log'])) : ''; + $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : ''; $rememberme = ! empty( $_POST['rememberme'] ); + + if ( ! empty( $errors->errors ) ) { + $aria_describedby_error = ' aria-describedby="login_error"'; + } else { + $aria_describedby_error = ''; + } ?> - + @@ -714,7 +944,7 @@ default: