wp/wp-login.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    11 /** Make sure that the WordPress bootstrap has run before continuing. */
    11 /** Make sure that the WordPress bootstrap has run before continuing. */
    12 require __DIR__ . '/wp-load.php';
    12 require __DIR__ . '/wp-load.php';
    13 
    13 
    14 // Redirect to HTTPS login if forced to use SSL.
    14 // Redirect to HTTPS login if forced to use SSL.
    15 if ( force_ssl_admin() && ! is_ssl() ) {
    15 if ( force_ssl_admin() && ! is_ssl() ) {
    16 	if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
    16 	if ( str_starts_with( $_SERVER['REQUEST_URI'], 'http' ) ) {
    17 		wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    17 		wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
    18 		exit;
    18 		exit;
    19 	} else {
    19 	} else {
    20 		wp_safe_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    20 		wp_safe_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
    21 		exit;
    21 		exit;
    22 	}
    22 	}
    23 }
    23 }
    24 
    24 
    25 /**
    25 /**
    26  * Output the login page header.
    26  * Outputs the login page header.
    27  *
    27  *
    28  * @since 2.1.0
    28  * @since 2.1.0
    29  *
    29  *
    30  * @global string      $error         Login error message set by deprecated pluggable wp_login() function
    30  * @global string      $error         Login error message set by deprecated pluggable wp_login() function
    31  *                                    or plugins replacing it.
    31  *                                    or plugins replacing it.
    32  * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success'
    32  * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success'
    33  *                                    upon successful login.
    33  *                                    upon successful login.
    34  * @global string      $action        The action that brought the visitor to the login page.
    34  * @global string      $action        The action that brought the visitor to the login page.
    35  *
    35  *
    36  * @param string   $title    Optional. WordPress login Page title to display in the `<title>` element.
    36  * @param string|null   $title    Optional. WordPress login page title to display in the `<title>` element.
    37  *                           Default 'Log In'.
    37  *                                Defaults to 'Log In'.
    38  * @param string   $message  Optional. Message to display in header. Default empty.
    38  * @param string        $message  Optional. Message to display in header. Default empty.
    39  * @param WP_Error $wp_error Optional. The error to pass. Default is a WP_Error instance.
    39  * @param WP_Error|null $wp_error Optional. The error to pass. Defaults to a WP_Error instance.
    40  */
    40  */
    41 function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
    41 function login_header( $title = null, $message = '', $wp_error = null ) {
    42 	global $error, $interim_login, $action;
    42 	global $error, $interim_login, $action;
       
    43 
       
    44 	if ( null === $title ) {
       
    45 		$title = __( 'Log In' );
       
    46 	}
    43 
    47 
    44 	// Don't index any of these forms.
    48 	// Don't index any of these forms.
    45 	add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
    49 	add_filter( 'wp_robots', 'wp_robots_sensitive_page' );
    46 	add_action( 'login_head', 'wp_strict_cross_origin_referrer' );
    50 	add_action( 'login_head', 'wp_strict_cross_origin_referrer' );
    47 
    51 
    99 	 * Remove all stored post data on logging out.
   103 	 * Remove all stored post data on logging out.
   100 	 * This could be added by add_action('login_head'...) like wp_shake_js(),
   104 	 * This could be added by add_action('login_head'...) like wp_shake_js(),
   101 	 * but maybe better if it's not removable by plugins.
   105 	 * but maybe better if it's not removable by plugins.
   102 	 */
   106 	 */
   103 	if ( 'loggedout' === $wp_error->get_error_code() ) {
   107 	if ( 'loggedout' === $wp_error->get_error_code() ) {
       
   108 		ob_start();
   104 		?>
   109 		?>
   105 		<script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
   110 		<script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
   106 		<?php
   111 		<?php
       
   112 		wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
   107 	}
   113 	}
   108 
   114 
   109 	/**
   115 	/**
   110 	 * Enqueue scripts and styles for the login page.
   116 	 * Enqueues scripts and styles for the login page.
   111 	 *
   117 	 *
   112 	 * @since 3.1.0
   118 	 * @since 3.1.0
   113 	 */
   119 	 */
   114 	do_action( 'login_enqueue_scripts' );
   120 	do_action( 'login_enqueue_scripts' );
   115 
   121 
   191 	$classes = apply_filters( 'login_body_class', $classes, $action );
   197 	$classes = apply_filters( 'login_body_class', $classes, $action );
   192 
   198 
   193 	?>
   199 	?>
   194 	</head>
   200 	</head>
   195 	<body class="login no-js <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
   201 	<body class="login no-js <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
   196 	<script type="text/javascript">
   202 	<?php
   197 		document.body.className = document.body.className.replace('no-js','js');
   203 	wp_print_inline_script_tag( "document.body.className = document.body.className.replace('no-js','js');" );
   198 	</script>
   204 	?>
       
   205 
   199 	<?php
   206 	<?php
   200 	/**
   207 	/**
   201 	 * Fires in the login page header after the body tag is opened.
   208 	 * Fires in the login page header after the body tag is opened.
   202 	 *
   209 	 *
   203 	 * @since 4.6.0
   210 	 * @since 4.6.0
   226 		$wp_error->add( 'error', $error );
   233 		$wp_error->add( 'error', $error );
   227 		unset( $error );
   234 		unset( $error );
   228 	}
   235 	}
   229 
   236 
   230 	if ( $wp_error->has_errors() ) {
   237 	if ( $wp_error->has_errors() ) {
   231 		$errors   = '';
   238 		$error_list = array();
   232 		$messages = '';
   239 		$messages   = '';
   233 
   240 
   234 		foreach ( $wp_error->get_error_codes() as $code ) {
   241 		foreach ( $wp_error->get_error_codes() as $code ) {
   235 			$severity = $wp_error->get_error_data( $code );
   242 			$severity = $wp_error->get_error_data( $code );
   236 			foreach ( $wp_error->get_error_messages( $code ) as $error_message ) {
   243 			foreach ( $wp_error->get_error_messages( $code ) as $error_message ) {
   237 				if ( 'message' === $severity ) {
   244 				if ( 'message' === $severity ) {
   238 					$messages .= '	' . $error_message . "<br />\n";
   245 					$messages .= '<p>' . $error_message . '</p>';
   239 				} else {
   246 				} else {
   240 					$errors .= '	' . $error_message . "<br />\n";
   247 					$error_list[] = $error_message;
   241 				}
   248 				}
   242 			}
   249 			}
   243 		}
   250 		}
   244 
   251 
   245 		if ( ! empty( $errors ) ) {
   252 		if ( ! empty( $error_list ) ) {
       
   253 			$errors = '';
       
   254 
       
   255 			if ( count( $error_list ) > 1 ) {
       
   256 				$errors .= '<ul class="login-error-list">';
       
   257 
       
   258 				foreach ( $error_list as $item ) {
       
   259 					$errors .= '<li>' . $item . '</li>';
       
   260 				}
       
   261 
       
   262 				$errors .= '</ul>';
       
   263 			} else {
       
   264 				$errors .= '<p>' . $error_list[0] . '</p>';
       
   265 			}
       
   266 
   246 			/**
   267 			/**
   247 			 * Filters the error messages displayed above the login form.
   268 			 * Filters the error messages displayed above the login form.
   248 			 *
   269 			 *
   249 			 * @since 2.1.0
   270 			 * @since 2.1.0
   250 			 *
   271 			 *
   251 			 * @param string $errors Login error message.
   272 			 * @param string $errors Login error messages.
   252 			 */
   273 			 */
   253 			echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n";
   274 			$errors = apply_filters( 'login_errors', $errors );
       
   275 
       
   276 			wp_admin_notice(
       
   277 				$errors,
       
   278 				array(
       
   279 					'type'           => 'error',
       
   280 					'id'             => 'login_error',
       
   281 					'paragraph_wrap' => false,
       
   282 				)
       
   283 			);
   254 		}
   284 		}
   255 
   285 
   256 		if ( ! empty( $messages ) ) {
   286 		if ( ! empty( $messages ) ) {
   257 			/**
   287 			/**
   258 			 * Filters instructional messages displayed above the login form.
   288 			 * Filters instructional messages displayed above the login form.
   259 			 *
   289 			 *
   260 			 * @since 2.5.0
   290 			 * @since 2.5.0
   261 			 *
   291 			 *
   262 			 * @param string $messages Login messages.
   292 			 * @param string $messages Login messages.
   263 			 */
   293 			 */
   264 			echo '<p class="message">' . apply_filters( 'login_messages', $messages ) . "</p>\n";
   294 			$messages = apply_filters( 'login_messages', $messages );
       
   295 
       
   296 			wp_admin_notice(
       
   297 				$messages,
       
   298 				array(
       
   299 					'type'               => 'info',
       
   300 					'id'                 => 'login-message',
       
   301 					'additional_classes' => array( 'message' ),
       
   302 					'paragraph_wrap'     => false,
       
   303 				)
       
   304 			);
   265 		}
   305 		}
   266 	}
   306 	}
   267 } // End of login_header().
   307 } // End of login_header().
   268 
   308 
   269 /**
   309 /**
   292 					_x( '&larr; Go to %s', 'site' ),
   332 					_x( '&larr; Go to %s', 'site' ),
   293 					get_bloginfo( 'title', 'display' )
   333 					get_bloginfo( 'title', 'display' )
   294 				)
   334 				)
   295 			);
   335 			);
   296 			/**
   336 			/**
   297 			 * Filter the "Go to site" link displayed in the login page footer.
   337 			 * Filters the "Go to site" link displayed in the login page footer.
   298 			 *
   338 			 *
   299 			 * @since 5.7.0
   339 			 * @since 5.7.0
   300 			 *
   340 			 *
   301 			 * @param string $link HTML link to the home URL of the current site.
   341 			 * @param string $link HTML link to the home URL of the current site.
   302 			 */
   342 			 */
   313 
   353 
   314 	<?php
   354 	<?php
   315 	if (
   355 	if (
   316 		! $interim_login &&
   356 		! $interim_login &&
   317 		/**
   357 		/**
   318 		 * Filters the Languages select input activation on the login screen.
   358 		 * Filters whether to display the Language selector on the login screen.
   319 		 *
   359 		 *
   320 		 * @since 5.9.0
   360 		 * @since 5.9.0
   321 		 *
   361 		 *
   322 		 * @param bool Whether to display the Languages select input on the login screen.
   362 		 * @param bool $display Whether to display the Language selector on the login screen.
   323 		 */
   363 		 */
   324 		apply_filters( 'login_display_language_dropdown', true )
   364 		apply_filters( 'login_display_language_dropdown', true )
   325 	) {
   365 	) {
   326 		$languages = get_available_languages();
   366 		$languages = get_available_languages();
   327 
   367 
   328 		if ( ! empty( $languages ) ) {
   368 		if ( ! empty( $languages ) ) {
   329 			?>
   369 			?>
   330 			<div class="language-switcher">
   370 			<div class="language-switcher">
   331 				<form id="language-switcher" action="" method="get">
   371 				<form id="language-switcher" method="get">
   332 
   372 
   333 					<label for="language-switcher-locales">
   373 					<label for="language-switcher-locales">
   334 						<span class="dashicons dashicons-translation" aria-hidden="true"></span>
   374 						<span class="dashicons dashicons-translation" aria-hidden="true"></span>
   335 						<span class="screen-reader-text"><?php _e( 'Language' ); ?></span>
   375 						<span class="screen-reader-text">
       
   376 							<?php
       
   377 							/* translators: Hidden accessibility text. */
       
   378 							_e( 'Language' );
       
   379 							?>
       
   380 						</span>
   336 					</label>
   381 					</label>
   337 
   382 
   338 					<?php
   383 					<?php
   339 					$args = array(
   384 					$args = array(
   340 						'id'                          => 'language-switcher-locales',
   385 						'id'                          => 'language-switcher-locales',
   346 					);
   391 					);
   347 
   392 
   348 					/**
   393 					/**
   349 					 * Filters default arguments for the Languages select input on the login screen.
   394 					 * Filters default arguments for the Languages select input on the login screen.
   350 					 *
   395 					 *
       
   396 					 * The arguments get passed to the wp_dropdown_languages() function.
       
   397 					 *
   351 					 * @since 5.9.0
   398 					 * @since 5.9.0
   352 					 *
   399 					 *
   353 					 * @param array $args Arguments for the Languages select input on the login screen.
   400 					 * @param array $args Arguments for the Languages select input on the login screen.
   354 					 */
   401 					 */
   355 					wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) );
   402 					wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) );
   358 					<?php if ( $interim_login ) { ?>
   405 					<?php if ( $interim_login ) { ?>
   359 						<input type="hidden" name="interim-login" value="1" />
   406 						<input type="hidden" name="interim-login" value="1" />
   360 					<?php } ?>
   407 					<?php } ?>
   361 
   408 
   362 					<?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?>
   409 					<?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?>
   363 						<input type="hidden" name="redirect_to" value="<?php echo esc_url_raw( $_GET['redirect_to'] ); ?>" />
   410 						<input type="hidden" name="redirect_to" value="<?php echo sanitize_url( $_GET['redirect_to'] ); ?>" />
   364 					<?php } ?>
   411 					<?php } ?>
   365 
   412 
   366 					<?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?>
   413 					<?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?>
   367 						<input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" />
   414 						<input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" />
   368 					<?php } ?>
   415 					<?php } ?>
   374 		<?php } ?>
   421 		<?php } ?>
   375 	<?php } ?>
   422 	<?php } ?>
   376 	<?php
   423 	<?php
   377 
   424 
   378 	if ( ! empty( $input_id ) ) {
   425 	if ( ! empty( $input_id ) ) {
       
   426 		ob_start();
   379 		?>
   427 		?>
   380 		<script type="text/javascript">
   428 		<script>
   381 		try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
   429 		try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
   382 		if(typeof wpOnload==='function')wpOnload();
   430 		if(typeof wpOnload==='function')wpOnload();
   383 		</script>
   431 		</script>
   384 		<?php
   432 		<?php
       
   433 		wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
   385 	}
   434 	}
   386 
   435 
   387 	/**
   436 	/**
   388 	 * Fires in the login page footer.
   437 	 * Fires in the login page footer.
   389 	 *
   438 	 *
   390 	 * @since 3.1.0
   439 	 * @since 3.1.0
   391 	 */
   440 	 */
   392 	do_action( 'login_footer' );
   441 	do_action( 'login_footer' );
   393 
   442 
   394 	?>
   443 	?>
   395 	<div class="clear"></div>
       
   396 	</body>
   444 	</body>
   397 	</html>
   445 	</html>
   398 	<?php
   446 	<?php
   399 }
   447 }
   400 
   448 
   402  * Outputs the JavaScript to handle the form shaking on the login page.
   450  * Outputs the JavaScript to handle the form shaking on the login page.
   403  *
   451  *
   404  * @since 3.0.0
   452  * @since 3.0.0
   405  */
   453  */
   406 function wp_shake_js() {
   454 function wp_shake_js() {
   407 	?>
   455 	wp_print_inline_script_tag( "document.querySelector('form').classList.add('shake');" );
   408 	<script type="text/javascript">
       
   409 	document.querySelector('form').classList.add('shake');
       
   410 	</script>
       
   411 	<?php
       
   412 }
   456 }
   413 
   457 
   414 /**
   458 /**
   415  * Outputs the viewport meta tag for the login page.
   459  * Outputs the viewport meta tag for the login page.
   416  *
   460  *
   421 	<meta name="viewport" content="width=device-width" />
   465 	<meta name="viewport" content="width=device-width" />
   422 	<?php
   466 	<?php
   423 }
   467 }
   424 
   468 
   425 /*
   469 /*
   426  * Main part: check the request and redirect or display a form based on the current action.
   470  * Main part.
       
   471  *
       
   472  * Check the request and redirect or display a form based on the current action.
   427  */
   473  */
   428 
   474 
   429 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login';
   475 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login';
   430 $errors = new WP_Error();
   476 $errors = new WP_Error();
   431 
   477 
   640 			<p class="admin-email__details">
   686 			<p class="admin-email__details">
   641 				<?php _e( 'Please verify that the <strong>administration email</strong> for this website is still correct.' ); ?>
   687 				<?php _e( 'Please verify that the <strong>administration email</strong> for this website is still correct.' ); ?>
   642 				<?php
   688 				<?php
   643 
   689 
   644 				/* translators: URL to the WordPress help section about admin email. */
   690 				/* translators: URL to the WordPress help section about admin email. */
   645 				$admin_email_help_url = __( 'https://wordpress.org/support/article/settings-general-screen/#email-address' );
   691 				$admin_email_help_url = __( 'https://wordpress.org/documentation/article/settings-general-screen/#email-address' );
   646 
   692 
   647 				/* translators: Accessibility text. */
   693 				$accessibility_text = sprintf(
   648 				$accessibility_text = sprintf( '<span class="screen-reader-text"> %s</span>', __( '(opens in a new tab)' ) );
   694 					'<span class="screen-reader-text"> %s</span>',
       
   695 					/* translators: Hidden accessibility text. */
       
   696 					__( '(opens in a new tab)' )
       
   697 				);
   649 
   698 
   650 				printf(
   699 				printf(
   651 					'<a href="%s" rel="noopener" target="_blank">%s%s</a>',
   700 					'<a href="%s" rel="noopener" target="_blank">%s%s</a>',
   652 					esc_url( $admin_email_help_url ),
   701 					esc_url( $admin_email_help_url ),
   653 					__( 'Why is this important?' ),
   702 					__( 'Why is this important?' ),
   706 
   755 
   707 		login_footer();
   756 		login_footer();
   708 		break;
   757 		break;
   709 
   758 
   710 	case 'postpass':
   759 	case 'postpass':
   711 		if ( ! array_key_exists( 'post_password', $_POST ) ) {
   760 		if ( ! isset( $_POST['post_password'] ) || ! is_string( $_POST['post_password'] ) ) {
   712 			wp_safe_redirect( wp_get_referer() );
   761 			wp_safe_redirect( wp_get_referer() );
   713 			exit;
   762 			exit;
   714 		}
   763 		}
   715 
   764 
   716 		require_once ABSPATH . WPINC . '/class-phpass.php';
   765 		require_once ABSPATH . WPINC . '/class-phpass.php';
   745 
   794 
   746 		$user = wp_get_current_user();
   795 		$user = wp_get_current_user();
   747 
   796 
   748 		wp_logout();
   797 		wp_logout();
   749 
   798 
   750 		if ( ! empty( $_REQUEST['redirect_to'] ) ) {
   799 		if ( ! empty( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) {
   751 			$redirect_to           = $_REQUEST['redirect_to'];
   800 			$redirect_to           = $_REQUEST['redirect_to'];
   752 			$requested_redirect_to = $redirect_to;
   801 			$requested_redirect_to = $redirect_to;
   753 		} else {
   802 		} else {
   754 			$redirect_to = add_query_arg(
   803 			$redirect_to = add_query_arg(
   755 				array(
   804 				array(
   788 			}
   837 			}
   789 		}
   838 		}
   790 
   839 
   791 		if ( isset( $_GET['error'] ) ) {
   840 		if ( isset( $_GET['error'] ) ) {
   792 			if ( 'invalidkey' === $_GET['error'] ) {
   841 			if ( 'invalidkey' === $_GET['error'] ) {
   793 				$errors->add( 'invalidkey', __( '<strong>Error</strong>: Your password reset link appears to be invalid. Please request a new link below.' ) );
   842 				$errors->add( 'invalidkey', __( '<strong>Error:</strong> Your password reset link appears to be invalid. Please request a new link below.' ) );
   794 			} elseif ( 'expiredkey' === $_GET['error'] ) {
   843 			} elseif ( 'expiredkey' === $_GET['error'] ) {
   795 				$errors->add( 'expiredkey', __( '<strong>Error</strong>: Your password reset link has expired. Please request a new link below.' ) );
   844 				$errors->add( 'expiredkey', __( '<strong>Error:</strong> Your password reset link has expired. Please request a new link below.' ) );
   796 			}
   845 			}
   797 		}
   846 		}
   798 
   847 
   799 		$lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
   848 		$lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
   800 		/**
   849 		/**
   815 		 * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid
   864 		 * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid
   816 		 *                         credentials. Note that the error object may not contain any errors.
   865 		 *                         credentials. Note that the error object may not contain any errors.
   817 		 */
   866 		 */
   818 		do_action( 'lost_password', $errors );
   867 		do_action( 'lost_password', $errors );
   819 
   868 
   820 		login_header( __( 'Lost Password' ), '<p class="message">' . __( 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.' ) . '</p>', $errors );
   869 		login_header(
       
   870 			__( 'Lost Password' ),
       
   871 			wp_get_admin_notice(
       
   872 				__( 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.' ),
       
   873 				array(
       
   874 					'type'               => 'info',
       
   875 					'additional_classes' => array( 'message' ),
       
   876 				)
       
   877 			),
       
   878 			$errors
       
   879 		);
   821 
   880 
   822 		$user_login = '';
   881 		$user_login = '';
   823 
   882 
   824 		if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) {
   883 		if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) {
   825 			$user_login = wp_unslash( $_POST['user_login'] );
   884 			$user_login = wp_unslash( $_POST['user_login'] );
   828 		?>
   887 		?>
   829 
   888 
   830 		<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
   889 		<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
   831 			<p>
   890 			<p>
   832 				<label for="user_login"><?php _e( 'Username or Email Address' ); ?></label>
   891 				<label for="user_login"><?php _e( 'Username or Email Address' ); ?></label>
   833 				<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" />
   892 				<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" />
   834 			</p>
   893 			</p>
   835 			<?php
   894 			<?php
   836 
   895 
   837 			/**
   896 			/**
   838 			 * Fires inside the lostpassword form tags, before the hidden fields.
   897 			 * Fires inside the lostpassword form tags, before the hidden fields.
   847 				<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); ?>" />
   906 				<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); ?>" />
   848 			</p>
   907 			</p>
   849 		</form>
   908 		</form>
   850 
   909 
   851 		<p id="nav">
   910 		<p id="nav">
   852 			<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
   911 			<a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
   853 			<?php
   912 			<?php
   854 
   913 
   855 			if ( get_option( 'users_can_register' ) ) {
   914 			if ( get_option( 'users_can_register' ) ) {
   856 				$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
   915 				$registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
   857 
   916 
   858 				echo esc_html( $login_link_separator );
   917 				echo esc_html( $login_link_separator );
   859 
   918 
   860 				/** This filter is documented in wp-includes/general-template.php */
   919 				/** This filter is documented in wp-includes/general-template.php */
   861 				echo apply_filters( 'register', $registration_url );
   920 				echo apply_filters( 'register', $registration_url );
   916 			}
   975 			}
   917 		}
   976 		}
   918 
   977 
   919 		// Check if password fields do not match.
   978 		// Check if password fields do not match.
   920 		if ( ! empty( $_POST['pass1'] ) && trim( $_POST['pass2'] ) !== $_POST['pass1'] ) {
   979 		if ( ! empty( $_POST['pass1'] ) && trim( $_POST['pass2'] ) !== $_POST['pass1'] ) {
   921 			$errors->add( 'password_reset_mismatch', __( '<strong>Error</strong>: The passwords do not match.' ) );
   980 			$errors->add( 'password_reset_mismatch', __( '<strong>Error:</strong> The passwords do not match.' ) );
   922 		}
   981 		}
   923 
   982 
   924 		/**
   983 		/**
   925 		 * Fires before the password reset procedure is validated.
   984 		 * Fires before the password reset procedure is validated.
   926 		 *
   985 		 *
   932 		do_action( 'validate_password_reset', $errors, $user );
   991 		do_action( 'validate_password_reset', $errors, $user );
   933 
   992 
   934 		if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) {
   993 		if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) {
   935 			reset_password( $user, $_POST['pass1'] );
   994 			reset_password( $user, $_POST['pass1'] );
   936 			setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
   995 			setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
   937 			login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' );
   996 			login_header(
       
   997 				__( 'Password Reset' ),
       
   998 				wp_get_admin_notice(
       
   999 					__( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a>',
       
  1000 					array(
       
  1001 						'type'               => 'info',
       
  1002 						'additional_classes' => array( 'message', 'reset-pass' ),
       
  1003 					)
       
  1004 				)
       
  1005 			);
   938 			login_footer();
  1006 			login_footer();
   939 			exit;
  1007 			exit;
   940 		}
  1008 		}
   941 
  1009 
   942 		wp_enqueue_script( 'utils' );
  1010 		wp_enqueue_script( 'utils' );
   943 		wp_enqueue_script( 'user-profile' );
  1011 		wp_enqueue_script( 'user-profile' );
   944 
  1012 
   945 		login_header( __( 'Reset Password' ), '<p class="message reset-pass">' . __( 'Enter your new password below or generate one.' ) . '</p>', $errors );
  1013 		login_header(
       
  1014 			__( 'Reset Password' ),
       
  1015 			wp_get_admin_notice(
       
  1016 				__( 'Enter your new password below or generate one.' ),
       
  1017 				array(
       
  1018 					'type'               => 'info',
       
  1019 					'additional_classes' => array( 'message', 'reset-pass' ),
       
  1020 				)
       
  1021 			),
       
  1022 			$errors
       
  1023 		);
   946 
  1024 
   947 		?>
  1025 		?>
   948 		<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
  1026 		<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
   949 			<input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />
  1027 			<input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />
   950 
  1028 
   952 				<p>
  1030 				<p>
   953 					<label for="pass1"><?php _e( 'New password' ); ?></label>
  1031 					<label for="pass1"><?php _e( 'New password' ); ?></label>
   954 				</p>
  1032 				</p>
   955 
  1033 
   956 				<div class="wp-pwd">
  1034 				<div class="wp-pwd">
   957 					<input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="new-password" aria-describedby="pass-strength-result" />
  1035 					<input type="password" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="new-password" spellcheck="false" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" aria-describedby="pass-strength-result" />
   958 
  1036 
   959 					<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
  1037 					<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
   960 						<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
  1038 						<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
   961 					</button>
  1039 					</button>
   962 					<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div>
  1040 					<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div>
   967 				</div>
  1045 				</div>
   968 			</div>
  1046 			</div>
   969 
  1047 
   970 			<p class="user-pass2-wrap">
  1048 			<p class="user-pass2-wrap">
   971 				<label for="pass2"><?php _e( 'Confirm new password' ); ?></label>
  1049 				<label for="pass2"><?php _e( 'Confirm new password' ); ?></label>
   972 				<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="new-password" />
  1050 				<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="new-password" spellcheck="false" />
   973 			</p>
  1051 			</p>
   974 
  1052 
   975 			<p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
  1053 			<p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
   976 			<br class="clear" />
       
   977 
  1054 
   978 			<?php
  1055 			<?php
   979 
  1056 
   980 			/**
  1057 			/**
   981 			 * Fires following the 'Strength indicator' meter in the user password reset form.
  1058 			 * Fires following the 'Strength indicator' meter in the user password reset form.
   993 				<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" />
  1070 				<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" />
   994 			</p>
  1071 			</p>
   995 		</form>
  1072 		</form>
   996 
  1073 
   997 		<p id="nav">
  1074 		<p id="nav">
   998 			<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
  1075 			<a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
   999 			<?php
  1076 			<?php
  1000 
  1077 
  1001 			if ( get_option( 'users_can_register' ) ) {
  1078 			if ( get_option( 'users_can_register' ) ) {
  1002 				$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
  1079 				$registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
  1003 
  1080 
  1004 				echo esc_html( $login_link_separator );
  1081 				echo esc_html( $login_link_separator );
  1005 
  1082 
  1006 				/** This filter is documented in wp-includes/general-template.php */
  1083 				/** This filter is documented in wp-includes/general-template.php */
  1007 				echo apply_filters( 'register', $registration_url );
  1084 				echo apply_filters( 'register', $registration_url );
  1065 		 * @param int|WP_Error $errors                User id if registration was successful,
  1142 		 * @param int|WP_Error $errors                User id if registration was successful,
  1066 		 *                                            WP_Error object otherwise.
  1143 		 *                                            WP_Error object otherwise.
  1067 		 */
  1144 		 */
  1068 		$redirect_to = apply_filters( 'registration_redirect', $registration_redirect, $errors );
  1145 		$redirect_to = apply_filters( 'registration_redirect', $registration_redirect, $errors );
  1069 
  1146 
  1070 		login_header( __( 'Registration Form' ), '<p class="message register">' . __( 'Register For This Site' ) . '</p>', $errors );
  1147 		login_header(
       
  1148 			__( 'Registration Form' ),
       
  1149 			wp_get_admin_notice(
       
  1150 				__( 'Register For This Site' ),
       
  1151 				array(
       
  1152 					'type'               => 'info',
       
  1153 					'additional_classes' => array( 'message', 'register' ),
       
  1154 				)
       
  1155 			),
       
  1156 			$errors
       
  1157 		);
  1071 
  1158 
  1072 		?>
  1159 		?>
  1073 		<form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate">
  1160 		<form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate">
  1074 			<p>
  1161 			<p>
  1075 				<label for="user_login"><?php _e( 'Username' ); ?></label>
  1162 				<label for="user_login"><?php _e( 'Username' ); ?></label>
  1076 				<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" autocomplete="username" />
  1163 				<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" />
  1077 			</p>
  1164 			</p>
  1078 			<p>
  1165 			<p>
  1079 				<label for="user_email"><?php _e( 'Email' ); ?></label>
  1166 				<label for="user_email"><?php _e( 'Email' ); ?></label>
  1080 				<input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" autocomplete="email" />
  1167 				<input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" autocomplete="email" required="required" />
  1081 			</p>
  1168 			</p>
  1082 			<?php
  1169 			<?php
  1083 
  1170 
  1084 			/**
  1171 			/**
  1085 			 * Fires following the 'Email' field in the user registration form.
  1172 			 * Fires following the 'Email' field in the user registration form.
  1090 
  1177 
  1091 			?>
  1178 			?>
  1092 			<p id="reg_passmail">
  1179 			<p id="reg_passmail">
  1093 				<?php _e( 'Registration confirmation will be emailed to you.' ); ?>
  1180 				<?php _e( 'Registration confirmation will be emailed to you.' ); ?>
  1094 			</p>
  1181 			</p>
  1095 			<br class="clear" />
       
  1096 			<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
  1182 			<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
  1097 			<p class="submit">
  1183 			<p class="submit">
  1098 				<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" />
  1184 				<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" />
  1099 			</p>
  1185 			</p>
  1100 		</form>
  1186 		</form>
  1101 
  1187 
  1102 		<p id="nav">
  1188 		<p id="nav">
  1103 			<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
  1189 			<a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
  1104 				<?php echo esc_html( $login_link_separator ); ?>
  1190 			<?php
  1105 			<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a>
  1191 
       
  1192 			echo esc_html( $login_link_separator );
       
  1193 
       
  1194 			$html_link = sprintf( '<a class="wp-login-lost-password" href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );
       
  1195 
       
  1196 			/** This filter is documented in wp-login.php */
       
  1197 			echo apply_filters( 'lost_password_html_link', $html_link );
       
  1198 
       
  1199 			?>
  1106 		</p>
  1200 		</p>
  1107 		<?php
  1201 		<?php
  1108 
  1202 
  1109 		login_footer( 'user_login' );
  1203 		login_footer( 'user_login' );
  1110 		break;
  1204 		break;
  1204 					force_ssl_admin( true );
  1298 					force_ssl_admin( true );
  1205 				}
  1299 				}
  1206 			}
  1300 			}
  1207 		}
  1301 		}
  1208 
  1302 
  1209 		if ( isset( $_REQUEST['redirect_to'] ) ) {
  1303 		if ( isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) {
  1210 			$redirect_to = $_REQUEST['redirect_to'];
  1304 			$redirect_to = $_REQUEST['redirect_to'];
  1211 			// Redirect to HTTPS if user wants SSL.
  1305 			// Redirect to HTTPS if user wants SSL.
  1212 			if ( $secure_cookie && false !== strpos( $redirect_to, 'wp-admin' ) ) {
  1306 			if ( $secure_cookie && str_contains( $redirect_to, 'wp-admin' ) ) {
  1213 				$redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
  1307 				$redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
  1214 			}
  1308 			}
  1215 		} else {
  1309 		} else {
  1216 			$redirect_to = admin_url();
  1310 			$redirect_to = admin_url();
  1217 		}
  1311 		}
  1224 			if ( headers_sent() ) {
  1318 			if ( headers_sent() ) {
  1225 				$user = new WP_Error(
  1319 				$user = new WP_Error(
  1226 					'test_cookie',
  1320 					'test_cookie',
  1227 					sprintf(
  1321 					sprintf(
  1228 						/* translators: 1: Browser cookie documentation URL, 2: Support forums URL. */
  1322 						/* translators: 1: Browser cookie documentation URL, 2: Support forums URL. */
  1229 						__( '<strong>Error</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ),
  1323 						__( '<strong>Error:</strong> Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ),
  1230 						__( 'https://wordpress.org/support/article/cookies/' ),
  1324 						__( 'https://developer.wordpress.org/advanced-administration/wordpress/cookies/' ),
  1231 						__( 'https://wordpress.org/support/forums/' )
  1325 						__( 'https://wordpress.org/support/forums/' )
  1232 					)
  1326 					)
  1233 				);
  1327 				);
  1234 			} elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
  1328 			} elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
  1235 				// If cookies are disabled, we can't log in even with a valid user and password.
  1329 				// If cookies are disabled, the user can't log in even with a valid username and password.
  1236 				$user = new WP_Error(
  1330 				$user = new WP_Error(
  1237 					'test_cookie',
  1331 					'test_cookie',
  1238 					sprintf(
  1332 					sprintf(
  1239 						/* translators: %s: Browser cookie documentation URL. */
  1333 						/* translators: %s: Browser cookie documentation URL. */
  1240 						__( '<strong>Error</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ),
  1334 						__( '<strong>Error:</strong> Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ),
  1241 						__( 'https://wordpress.org/support/article/cookies/#enable-cookies-in-your-browser' )
  1335 						__( 'https://developer.wordpress.org/advanced-administration/wordpress/cookies/#enable-cookies-in-your-browser' )
  1242 					)
  1336 					)
  1243 				);
  1337 				);
  1244 			}
  1338 			}
  1245 		}
  1339 		}
  1246 
  1340 
  1247 		$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
  1341 		$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
       
  1342 
  1248 		/**
  1343 		/**
  1249 		 * Filters the login redirect URL.
  1344 		 * Filters the login redirect URL.
  1250 		 *
  1345 		 *
  1251 		 * @since 3.0.0
  1346 		 * @since 3.0.0
  1252 		 *
  1347 		 *
  1268 
  1363 
  1269 				/** This action is documented in wp-login.php */
  1364 				/** This action is documented in wp-login.php */
  1270 				do_action( 'login_footer' );
  1365 				do_action( 'login_footer' );
  1271 
  1366 
  1272 				if ( $customize_login ) {
  1367 				if ( $customize_login ) {
       
  1368 					ob_start();
  1273 					?>
  1369 					?>
  1274 					<script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>
  1370 					<script>setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>
  1275 					<?php
  1371 					<?php
       
  1372 					wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
  1276 				}
  1373 				}
  1277 
  1374 
  1278 				?>
  1375 				?>
  1279 				</body></html>
  1376 				</body></html>
  1280 				<?php
  1377 				<?php
  1281 
  1378 
  1282 				exit;
  1379 				exit;
  1283 			}
  1380 			}
  1284 
  1381 
  1285 			// Check if it is time to add a redirect to the admin email confirmation screen.
  1382 			// Check if it is time to add a redirect to the admin email confirmation screen.
  1286 			if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) {
  1383 			if ( $user instanceof WP_User && $user->exists() && $user->has_cap( 'manage_options' ) ) {
  1287 				$admin_email_lifespan = (int) get_option( 'admin_email_lifespan' );
  1384 				$admin_email_lifespan = (int) get_option( 'admin_email_lifespan' );
  1288 
  1385 
  1289 				/*
  1386 				/*
  1290 				 * If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected
  1387 				 * If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected
  1291 				 * to the admin email confirmation screen.
  1388 				 * to the admin email confirmation screen.
  1339 		} else {
  1436 		} else {
  1340 			// Some parts of this script use the main login form to display a message.
  1437 			// Some parts of this script use the main login form to display a message.
  1341 			if ( isset( $_GET['loggedout'] ) && $_GET['loggedout'] ) {
  1438 			if ( isset( $_GET['loggedout'] ) && $_GET['loggedout'] ) {
  1342 				$errors->add( 'loggedout', __( 'You are now logged out.' ), 'message' );
  1439 				$errors->add( 'loggedout', __( 'You are now logged out.' ), 'message' );
  1343 			} elseif ( isset( $_GET['registration'] ) && 'disabled' === $_GET['registration'] ) {
  1440 			} elseif ( isset( $_GET['registration'] ) && 'disabled' === $_GET['registration'] ) {
  1344 				$errors->add( 'registerdisabled', __( '<strong>Error</strong>: User registration is currently not allowed.' ) );
  1441 				$errors->add( 'registerdisabled', __( '<strong>Error:</strong> User registration is currently not allowed.' ) );
  1345 			} elseif ( strpos( $redirect_to, 'about.php?updated' ) ) {
  1442 			} elseif ( str_contains( $redirect_to, 'about.php?updated' ) ) {
  1346 				$errors->add( 'updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.' ), 'message' );
  1443 				$errors->add( 'updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.' ), 'message' );
  1347 			} elseif ( WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED === $action ) {
  1444 			} elseif ( WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED === $action ) {
  1348 				$errors->add( 'enter_recovery_mode', __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' );
  1445 				$errors->add( 'enter_recovery_mode', __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' );
  1349 			} elseif ( isset( $_GET['redirect_to'] ) && false !== strpos( $_GET['redirect_to'], 'wp-admin/authorize-application.php' ) ) {
  1446 			} elseif ( isset( $_GET['redirect_to'] ) && is_string( $_GET['redirect_to'] )
       
  1447 				&& str_contains( $_GET['redirect_to'], 'wp-admin/authorize-application.php' )
       
  1448 			) {
  1350 				$query_component = wp_parse_url( $_GET['redirect_to'], PHP_URL_QUERY );
  1449 				$query_component = wp_parse_url( $_GET['redirect_to'], PHP_URL_QUERY );
  1351 				$query           = array();
  1450 				$query           = array();
  1352 				if ( $query_component ) {
  1451 				if ( $query_component ) {
  1353 					parse_str( $query_component, $query );
  1452 					parse_str( $query_component, $query );
  1354 				}
  1453 				}
  1386 			$user_login = ( 'incorrect_password' === $errors->get_error_code() || 'empty_password' === $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : '';
  1485 			$user_login = ( 'incorrect_password' === $errors->get_error_code() || 'empty_password' === $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : '';
  1387 		}
  1486 		}
  1388 
  1487 
  1389 		$rememberme = ! empty( $_POST['rememberme'] );
  1488 		$rememberme = ! empty( $_POST['rememberme'] );
  1390 
  1489 
  1391 		if ( $errors->has_errors() ) {
  1490 		$aria_describedby = '';
  1392 			$aria_describedby_error = ' aria-describedby="login_error"';
  1491 		$has_errors       = $errors->has_errors();
  1393 		} else {
  1492 
  1394 			$aria_describedby_error = '';
  1493 		if ( $has_errors ) {
       
  1494 			$aria_describedby = ' aria-describedby="login_error"';
       
  1495 		}
       
  1496 
       
  1497 		if ( $has_errors && 'message' === $errors->get_error_data() ) {
       
  1498 			$aria_describedby = ' aria-describedby="login-message"';
  1395 		}
  1499 		}
  1396 
  1500 
  1397 		wp_enqueue_script( 'user-profile' );
  1501 		wp_enqueue_script( 'user-profile' );
  1398 		?>
  1502 		?>
  1399 
  1503 
  1400 		<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
  1504 		<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
  1401 			<p>
  1505 			<p>
  1402 				<label for="user_login"><?php _e( 'Username or Email Address' ); ?></label>
  1506 				<label for="user_login"><?php _e( 'Username or Email Address' ); ?></label>
  1403 				<input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" />
  1507 				<input type="text" name="log" id="user_login"<?php echo $aria_describedby; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" />
  1404 			</p>
  1508 			</p>
  1405 
  1509 
  1406 			<div class="user-pass-wrap">
  1510 			<div class="user-pass-wrap">
  1407 				<label for="user_pass"><?php _e( 'Password' ); ?></label>
  1511 				<label for="user_pass"><?php _e( 'Password' ); ?></label>
  1408 				<div class="wp-pwd">
  1512 				<div class="wp-pwd">
  1409 					<input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input password-input" value="" size="20" autocomplete="current-password" />
  1513 					<input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby; ?> class="input password-input" value="" size="20" autocomplete="current-password" spellcheck="false" required="required" />
  1410 					<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Show password' ); ?>">
  1514 					<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Show password' ); ?>">
  1411 						<span class="dashicons dashicons-visibility" aria-hidden="true"></span>
  1515 						<span class="dashicons dashicons-visibility" aria-hidden="true"></span>
  1412 					</button>
  1516 					</button>
  1413 				</div>
  1517 				</div>
  1414 			</div>
  1518 			</div>
  1454 			?>
  1558 			?>
  1455 			<p id="nav">
  1559 			<p id="nav">
  1456 				<?php
  1560 				<?php
  1457 
  1561 
  1458 				if ( get_option( 'users_can_register' ) ) {
  1562 				if ( get_option( 'users_can_register' ) ) {
  1459 					$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
  1563 					$registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
  1460 
  1564 
  1461 					/** This filter is documented in wp-includes/general-template.php */
  1565 					/** This filter is documented in wp-includes/general-template.php */
  1462 					echo apply_filters( 'register', $registration_url );
  1566 					echo apply_filters( 'register', $registration_url );
  1463 
  1567 
  1464 					echo esc_html( $login_link_separator );
  1568 					echo esc_html( $login_link_separator );
  1465 				}
  1569 				}
  1466 
  1570 
       
  1571 				$html_link = sprintf( '<a class="wp-login-lost-password" href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) );
       
  1572 
       
  1573 				/**
       
  1574 				 * Filters the link that allows the user to reset the lost password.
       
  1575 				 *
       
  1576 				 * @since 6.1.0
       
  1577 				 *
       
  1578 				 * @param string $html_link HTML link to the lost password form.
       
  1579 				 */
       
  1580 				echo apply_filters( 'lost_password_html_link', $html_link );
       
  1581 
  1467 				?>
  1582 				?>
  1468 				<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a>
       
  1469 			</p>
  1583 			</p>
  1470 			<?php
  1584 			<?php
  1471 		}
  1585 		}
  1472 
  1586 
  1473 		$login_script  = 'function wp_attempt_focus() {';
  1587 		$login_script  = 'function wp_attempt_focus() {';
  1501 		}
  1615 		}
  1502 
  1616 
  1503 		// Run `wpOnload()` if defined.
  1617 		// Run `wpOnload()` if defined.
  1504 		$login_script .= "if ( typeof wpOnload === 'function' ) { wpOnload() }";
  1618 		$login_script .= "if ( typeof wpOnload === 'function' ) { wpOnload() }";
  1505 
  1619 
  1506 		?>
  1620 		wp_print_inline_script_tag( $login_script );
  1507 		<script type="text/javascript">
       
  1508 			<?php echo $login_script; ?>
       
  1509 		</script>
       
  1510 		<?php
       
  1511 
  1621 
  1512 		if ( $interim_login ) {
  1622 		if ( $interim_login ) {
       
  1623 			ob_start();
  1513 			?>
  1624 			?>
  1514 			<script type="text/javascript">
  1625 			<script>
  1515 			( function() {
  1626 			( function() {
  1516 				try {
  1627 				try {
  1517 					var i, links = document.getElementsByTagName( 'a' );
  1628 					var i, links = document.getElementsByTagName( 'a' );
  1518 					for ( i in links ) {
  1629 					for ( i in links ) {
  1519 						if ( links[i].href ) {
  1630 						if ( links[i].href ) {
  1523 					}
  1634 					}
  1524 				} catch( er ) {}
  1635 				} catch( er ) {}
  1525 			}());
  1636 			}());
  1526 			</script>
  1637 			</script>
  1527 			<?php
  1638 			<?php
       
  1639 			wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );
  1528 		}
  1640 		}
  1529 
  1641 
  1530 		login_footer();
  1642 		login_footer();
  1531 		break;
  1643 		break;
  1532 } // End action switch.
  1644 } // End action switch.