<?php
/**
 * LoginPress Template.
 *
 * Template Name: LoginPress
 * Template to display the WordPress login page in the WP-Customizer.
 * Purpose of this file is to provide a custom template for the login page within the WordPress Customizer.
 *
 * @package LoginPress
 * @since 1.1.3
 * @version 6.2.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// Redirect if viewed from outside the Customizer.
global $interim_login;

if ( ! is_customize_preview() ) {

	$loginpress_obj      = new LoginPress();
	$loginpress_page     = $loginpress_obj->get_loginpress_page();
	$loginpress_page_url = get_permalink( $loginpress_page );

	// Generate the redirect url.
	$loginpress_redirect_url = add_query_arg(
		array(
			'autofocus[panel]' => 'loginpress_panel',
			'return'           => admin_url( 'index.php' ),
			'url'              => rawurlencode( $loginpress_page_url ? $loginpress_page_url : '' ),
		),
		admin_url( 'customize.php' )
	);

	wp_safe_redirect( $loginpress_redirect_url );
}

	/**
	 * Make sure that the WordPress bootstrap has run before continuing.
	 *
	 * @phpstan-ignore-next-line
	 */
	require ABSPATH . '/wp-load.php';

// Redirect to https login if forced to use SSL.
if ( force_ssl_admin() && ! is_ssl() ) {
	if ( isset( $_SERVER['REQUEST_URI'] ) && 0 === strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'http' ) ) {
		wp_safe_redirect( set_url_scheme( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'https' ) );
		exit();
	} elseif ( isset( $_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI'] ) ) {
		wp_safe_redirect( 'https://' . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
		exit();
	}
}

/**
 * Output the login page header.
 *
 * @param string   $title    Optional. WordPress login Page title to display in the `<title>` element.
 *                           Default 'Log In'.
 * @param string   $message  Optional. Message to display in header. Default empty.
 * @param WP_Error $wp_error Optional. The error to pass. Default empty.
 * @return void
 */
function login_header( $title = 'Log In', $message = '', $wp_error = null ) {
	global $error, $interim_login, $action;

	// Don't index any of these forms.
	add_action( 'login_head', 'wp_no_robots' );

	add_action( 'login_head', 'wp_login_viewport_meta' );

	if ( null === $wp_error ) {
		$wp_error = new WP_Error();
	}

	$login_title = get_bloginfo( 'name', 'display' );

	/* translators: Login screen title. 1: Login screen name, 2: Network or site name */
	$login_title = sprintf( __( '%1$s &lsaquo; %2$s &#8212; WordPress' ), $title, $login_title ); // @codingStandardsIgnoreLine.

	/**
	* Filters the title tag content for login page.
	*
	* @since 4.9.0
	*
	* @param string $login_title The page title, with extra context added.
	* @param string $title       The original page title.
	*/
	$login_title = apply_filters( 'login_title', $login_title, $title );

	?><!DOCTYPE html>
	<!--[if IE 8]>
	<html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php language_attributes(); ?>>
	<![endif]-->
	<!--[if !(IE 8) ]><!-->
	<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
	<!--<![endif]-->
	<head>
	<title><?php echo esc_html( $login_title ); ?></title>
	<?php

	wp_enqueue_style( 'login' );

	/**
	* Enqueue scripts and styles for the login page.
	*
	* @since 3.0.1
	*/
	do_action( 'login_enqueue_scripts' );

	/**
	* Fires in the login page header after scripts are enqueued.
	*
	* @since 2.1.0
	*/
	do_action( 'login_head' );

	$classes = array( 'login-action-' . $action, 'wp-core-ui' );
	if ( is_rtl() ) {
		$classes[] = 'rtl';
	}

	if ( $interim_login ) {
		$classes[] = 'interim-login';
		?>

		<style type="text/css">html{background-color: transparent;}</style>
		<?php

		if ( 'success' === $interim_login ) {
			$classes[] = 'interim-login-success';
		}
	}
	$classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );

	/**
	* Filters the login page body classes.
	*
	* @since 3.5.0
	*
	* @param array  $classes An array of body classes.
	* @param string $action  The action that brought the visitor to the login page.
	*/
	$classes = apply_filters( 'login_body_class', $classes, $action );
	?>
	</head>
	<body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
	<?php
	/**
	 * Fires in the login page header after the body tag is opened.
	 *
	 * @since 4.6.0
	 */
	do_action( 'login_header' );

	if ( is_multisite() ) {
		$login_header_url   = network_home_url();
		$network            = get_network();
		$login_header_title = $network ? $network->site_name : '';
	} else {
		$login_header_url   = __( 'https://wordpress.org/' ); // @codingStandardsIgnoreLine.
		$login_header_title = __( 'Powered by WordPress' ); // @codingStandardsIgnoreLine.
	}

	/**
	* Filters link URL of the header logo above login form.
	*
	* @since 2.1.0
	*
	* @param string $login_header_url Login header logo URL.
	*/
	$login_header_url = apply_filters( 'login_headerurl', $login_header_url );

	/**
	* Filters the title attribute of the header logo above login form.
	*
	* @since 2.1.0
	*
	* @param string $login_header_title Login header logo title attribute.
	*/
	$login_header_title = apply_filters( 'login_headertitle', $login_header_title );

	/*
	* To match the URL/title set above, Multisite sites have the blog name,
	* while single sites get the header title.
	*/
	if ( is_multisite() ) {
		$login_header_text = get_bloginfo( 'name', 'display' );
	} else {
		$login_header_text = $login_header_title;
	}

	?>
	<div id="login">
	<h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1"><?php echo esc_html( $login_header_text ); ?></a></h1>
	<?php

	unset( $login_header_url, $login_header_title );

	/**
	* Filters the message to display above the login form.
	*
	* @since 2.1.0
	*
	* @param string $message Login message text.
	*/
	$message = apply_filters( 'login_message', $message );
	if ( ! empty( $message ) ) {
		echo wp_kses_post( $message ) . "\n";
	}

	// In case a plugin uses $error rather than the $wp_errors object.
	if ( ! empty( $error ) ) {
		$wp_error->add( 'error', $error );
		unset( $error );
	}

	if ( $wp_error->get_error_code() ) {
		$errors   = '';
		$messages = '';
		foreach ( $wp_error->get_error_codes() as $code ) {
			$severity = $wp_error->get_error_data( $code );
			foreach ( $wp_error->get_error_messages( $code ) as $error_message ) {
				if ( 'message' === $severity ) {
					$messages .= '	' . $error_message . "<br />\n";
				} else {
					$errors .= '	' . $error_message . "<br />\n";
				}
			}
		}
		if ( ! empty( $errors ) ) {
			/**
			* Filters the error messages displayed above the login form.
			*
			* @since 2.1.0
			*
			* @param string $errors Login error message.
			*/
			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Content is escaped by WP_Error.
			echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n";
		}
		if ( ! empty( $messages ) ) {
			/**
			* Filters instructional messages displayed above the login form.
			*
			* @since 2.5.0
			*
			* @param string $messages Login messages.
			*/
			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Content is escaped by WP_Error.
			echo '<p class="message">' . apply_filters( 'login_messages', $messages ) . "</p>\n";
		}
	}
} // End of login_header()

/**
 * Outputs the footer for the login page.
 *
 * @since 3.0.5
 *
 * @global bool|string $interim_login Whether interim login modal is being displayed. String 'success'
 * upon successful login.
 *
 * @param string $input_id Which input to auto-focus.
 * @return void
 */
function login_footer( $input_id = '' ) {
	global $interim_login;

	// Don't allow interim logins to navigate away from the page.
	if ( ! $interim_login ) {
		?>
		<p id="backtoblog">
			<?php
			$html_link = sprintf(
				'<a href="%s">%s</a>',
				esc_url( home_url( '/' ) ),
				sprintf(
					/* translators: %s: Site title. */
					_x( '&larr; Go to %s', 'site' ), // @codingStandardsIgnoreLine.
					get_bloginfo( 'title', 'display' )
				)
			);
			/**
			 * Filters the "Go to site" link displayed in the login page footer.
			 *
			 * @since 5.7.0
			 *
			 * @param string $link HTML link to the home URL of the current site.
			 */
			// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Filter output is escaped.
			echo apply_filters( 'login_site_html_link', $html_link );
			?>
		</p>
		<?php if ( ! empty( $input_id ) ) : ?>
			<script type="text/javascript">
			try{document.getElementById('<?php echo esc_js( $input_id ); ?>').focus();}catch(e){}
			if(typeof wpOnload=='function')wpOnload();
			</script>
			<?php
		endif;

		the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' );
	}

	?>
	</div>

	<?php
	if (
		! $interim_login &&
		/**
		 * Filters whether to display the Language selector on the login screen.
		 *
		 * @since 5.9.0
		 *
		 * @param bool $display Whether to display the Language selector on the login screen.
		 */
		apply_filters( 'login_display_language_dropdown', true )
	) {
		$languages = get_available_languages();

		if ( ! empty( $languages ) ) {
			?>
			<div class="language-switcher">
				<form id="language-switcher" action="" method="get">

					<label for="language-switcher-locales">
						<span class="dashicons dashicons-translation" aria-hidden="true"></span>
						<span class="screen-reader-text">
							<?php
							/* translators: Hidden accessibility text. */
							_e( 'Language' ); // @codingStandardsIgnoreLine.
							?>
						</span>
					</label>

					<?php
					$args = array(
						'id'                          => 'language-switcher-locales',
						'name'                        => 'wp_lang',
						'selected'                    => determine_locale(),
						'show_available_translations' => false,
						'explicit_option_en_us'       => true,
						'languages'                   => $languages,
					);

					/**
					 * Filters default arguments for the Languages select input on the login screen.
					 *
					 * The arguments get passed to the wp_dropdown_languages() function.
					 *
					 * @since 5.9.0
					 *
					 * @param array $args Arguments for the Languages select input on the login screen.
					 */
					wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) );
					?>
					<?php
					/**
					 * Handle interim login hidden field.
					 *
					 * @phpstan-ignore-next-line
					 */
					if ( $interim_login ) {
						?>
						<input type="hidden" name="interim-login" value="1" />
						<?php
					}
					// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for language switcher.
					if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) {
						?>
						<input type="hidden" name="redirect_to" value="<?php echo esc_url( wp_unslash( $_GET['redirect_to'] ) ); // phpcs:ignore ?>" />
						<?php
					}
					// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for language switcher.
					if ( isset( $_GET['action'] ) && '' !== sanitize_text_field( wp_unslash( $_GET['action'] ) ) ) {
						?>
						<input type="hidden" name="action" value="<?php echo esc_attr( sanitize_text_field( wp_unslash( $_GET['action'] ) ) ); // phpcs:ignore ?>" />
						<?php
					}
					?>

						<input type="submit" class="button" value="<?php esc_attr_e( 'Change' ); // @codingStandardsIgnoreLine.?>"> 

					</form>
				</div>
		<?php } ?>
	<?php } ?>
	<?php

	if ( ! empty( $input_id ) ) {
		ob_start();
		?>
		<script>
		try{document.getElementById('<?php echo esc_js( $input_id ); ?>').focus();}catch(e){}
		if(typeof wpOnload=='function')wpOnload();
		</script>
		<?php
		$script_content = ob_get_clean();
		wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( $script_content ? $script_content : '' ) );
	}

	/**
	 * Fires in the login page footer.
	 *
	 * @since 3.0.5
	 */
	do_action( 'login_footer' );

	?>
	</body>
	</html>
	<?php
}

/**
 * Output viewport meta tag for login page.
 *
 * @since 3.7.0
 * @version 6.2.0
 * @return void
 */
function wp_login_viewport_meta() {
	?>
	<meta name="viewport" content="width=device-width" />
	<?php
}

// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET/POST parameter for login action.
$loginpress_login_action = isset( $_REQUEST['action'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) : 'login';
$loginpress_login_errors = new WP_Error();

// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for password reset.
if ( isset( $_GET['key'] ) ) {
	$loginpress_login_action = 'resetpass';
}

// Validate action so as to default to the login screen.
if ( ! in_array( $loginpress_login_action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login' ), true ) && false === has_filter( 'login_form_' . $loginpress_login_action ) ) {
	$loginpress_login_action = 'login';
}

	nocache_headers();


if ( ! is_customize_preview() ) {
	header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) );

}
if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set.
	if ( isset( $_SERVER['PATH_INFO'], $_SERVER['PHP_SELF'] ) && ( sanitize_text_field( wp_unslash( $_SERVER['PATH_INFO'] ) ) !== sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) ) ) {
		$_SERVER['PHP_SELF'] = str_replace( sanitize_text_field( wp_unslash( $_SERVER['PATH_INFO'] ) ), '', sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) );
	}

	if ( isset( $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] ) ) {
		$loginpress_siteurl = dirname( set_url_scheme( 'http://' . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['PHP_SELF'] ) ) ) );
		if ( get_option( 'siteurl' ) !== $loginpress_siteurl ) {
			update_option( 'siteurl', $loginpress_siteurl );
		}
	}
}

// Set a cookie now to see if they are supported by the browser.
$loginpress_secure_cookie = ( 'https' === wp_parse_url( wp_login_url(), PHP_URL_SCHEME ) );
if ( ! is_customize_preview() ) {
	/**
	 * Set test cookie.
	 *
	 * @phpstan-ignore-next-line
	 */
	setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $loginpress_secure_cookie );
	/**
	 * Set test cookie for site path if different.
	 *
	 * @phpstan-ignore-next-line
	 */
	if ( SITECOOKIEPATH !== COOKIEPATH ) {
		/**
		 * Set test cookie for site path.
		 *
		 * @phpstan-ignore-next-line
		 */
		setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
	}
}

// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for language switcher.
$loginpress_lang            = ! empty( $_GET['wp_lang'] ) ? sanitize_text_field( wp_unslash( $_GET['wp_lang'] ) ) : '';
$loginpress_switched_locale = switch_to_locale( $loginpress_lang );

/**
* Fires when the login form is initialized.
*
* @since 3.2.0
*/
do_action( 'login_init' );

/**
* Fires before a specified login form action.
*
* The dynamic portion of the hook name, `$action`, refers to the action
* that brought the visitor to the login form. Actions include 'postpass',
* 'logout', 'lostpassword', etc.
*
* @since 2.8.0
*/
do_action( "login_form_{$loginpress_login_action}" );

$loginpress_http_post = ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' === sanitize_text_field( wp_unslash( $_SERVER['REQUEST_METHOD'] ) ) );
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET/POST parameter for interim login.
$loginpress_interim_login_request = isset( $_REQUEST['interim-login'] );

/**
* Filters the separator used between login form navigation links.
*
* @since 4.9.0
*
* @param string $loginpress_login_link_separator The separator used between login form navigation links.
*/
$loginpress_login_link_separator = apply_filters( 'login_link_separator', ' | ' );

switch ( $loginpress_login_action ) {

	case 'lostpassword':
	case 'retrievepassword':
		/**
		* Filters the URL redirected to after submitting the lostpassword/retrievepassword form.
		*
		* @since 3.0.0
		*
		* @param string $loginpress_lostpassword_redirect The redirect destination URL.
		*/
		$loginpress_lostpassword_redirect = '';
		$loginpress_redirect_to           = apply_filters( 'lostpassword_redirect', $loginpress_lostpassword_redirect );

		/**
		* Fires before the lost password form.
		*
		* @since 1.5.1
		*/
		do_action( 'lost_password' );

		login_header( __( 'Lost Password' ), '<p class="message">' . __( 'Please enter your username or email address. You will receive a link to create a new password via email.' ) . '</p>', $loginpress_login_errors ); // @codingStandardsIgnoreLine.

		$loginpress_lostpassword_user_login = '';

		// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the lost password form.
		if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) {
			// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the lost password form.
			$loginpress_lostpassword_user_login = sanitize_text_field( wp_unslash( $_POST['user_login'] ) );
		}

		?>

		<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
			<p>
				<label for="user_login" ><span><?php _e( 'Username or Email Address' ); // @codingStandardsIgnoreLine. ?></span><br />
				<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $loginpress_lostpassword_user_login ); ?>" size="20" /></label>
			</p>
			<?php
			/**
			 * Fires inside the lostpassword form tags, before the hidden fields.
			 *
			 * @since 2.1.0
			 */
			do_action( 'lostpassword_form' );
			?>
			<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $loginpress_redirect_to ); ?>" />
			<p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); // @codingStandardsIgnoreLine.?>" /></p>
		</form>

		<p id="nav">
			<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); // @codingStandardsIgnoreLine.?></a>
			<?php
			if ( get_option( 'users_can_register' ) ) :
				$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); // @codingStandardsIgnoreLine.

				echo esc_html( $loginpress_login_link_separator );

				/** This filter is documented in wp-includes/general-template.php */
				// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Filter output is escaped.
				echo apply_filters( 'register', $registration_url );
			endif;
			?>
		</p>

		<?php
		login_footer( 'user_login' );



		break;

	case 'resetpass':
	case 'register':
		if ( is_multisite() ) {
			/**
			* Filters the Multisite sign up URL.
			*
			* @since 3.0.0
			*
			* @param string $sign_up_url The sign up URL.
			*/
			wp_safe_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
			exit;
		}

		if ( ! get_option( 'users_can_register' ) ) {
			wp_safe_redirect( site_url( 'wp-login.php?registration=disabled' ) );
			exit();
		}

		$loginpress_register_user_login = '';
		$loginpress_register_user_email = '';

		if ( $loginpress_http_post ) {
			// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the registration form.
			if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) {
				// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the registration form.
				$loginpress_register_user_login = sanitize_text_field( wp_unslash( $_POST['user_login'] ) );
			}

			// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the registration form.
			if ( isset( $_POST['user_email'] ) && is_string( $_POST['user_email'] ) ) {
				// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the registration form.
				$loginpress_register_user_email = sanitize_email( wp_unslash( $_POST['user_email'] ) );
			}

			$loginpress_register_errors = register_new_user( $loginpress_register_user_login, $loginpress_register_user_email );
			if ( ! is_wp_error( $loginpress_register_errors ) ) {
				// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the registration form.
				$loginpress_redirect_to = ! empty( $_POST['redirect_to'] ) ? esc_url_raw( wp_unslash( $_POST['redirect_to'] ) ) : 'wp-login.php?checkemail=registered';
				wp_safe_redirect( $loginpress_redirect_to );
				exit();
			}
		}

		// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET/POST parameter for redirect.
		$loginpress_registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? esc_url_raw( wp_unslash( $_REQUEST['redirect_to'] ) ) : '';
		/**
		* Filters the registration redirect URL.
		*
		* @since 3.0.0
		* @version 6.2.0
		*
		* @param string $loginpress_registration_redirect The redirect destination URL.
		*/
		$loginpress_redirect_to = apply_filters( 'registration_redirect', $loginpress_registration_redirect );
		login_header( __( 'Registration Form' ), '<p class="message register">' . __( 'Register For This Site' ) . '</p>', $loginpress_register_errors ); // @codingStandardsIgnoreLine.
		?>
	<form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate">
		<p>
			<label for="user_login"><?php _e( 'Username' ); // @codingStandardsIgnoreLine.?><br />
			<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $loginpress_register_user_login ) ); ?>" size="20" /></label>
		</p>
		<p>
			<label for="user_email"><?php _e( 'Email' ); // @codingStandardsIgnoreLine.?><br />
			<input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $loginpress_register_user_email ) ); ?>" size="25" /></label>
		</p>
			<?php
			/**
			 * Fires following the 'Email' field in the user registration form.
			 *
			 * @since 2.1.0
			 * @version 6.2.0
			 */
			do_action( 'register_form' );
			?>
			<p id="reg_passmail"><?php _e( 'Registration confirmation will be emailed to you.' ); // @codingStandardsIgnoreLine.?></p>
			<br class="clear" />
			<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $loginpress_redirect_to ); ?>" />
			<p class="submit">
				<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); // @codingStandardsIgnoreLine.?>" />
			</p>
		</form>

		<p id="nav">
			<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); // @codingStandardsIgnoreLine.?></a>
			<?php echo esc_html( $loginpress_login_link_separator ); ?>
			<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); // @codingStandardsIgnoreLine.?></a>
		</p>

		<?php
		login_footer( 'user_login' );

		break;

	case 'login':
	default:
		$loginpress_secure_cookie_login = '';
		// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET/POST parameter for customizer.
		$loginpress_customize_login = isset( $_REQUEST['customize-login'] );
		if ( $loginpress_customize_login ) {
			wp_enqueue_script( 'customize-base' );
		}

		$loginpress_login_user_login = '';
		login_header( __( 'Log In' ), '', $loginpress_login_errors );// @codingStandardsIgnoreLine.
		$loginpress_aria_describedby_error = '';
		?>

	<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post" autocomplete="off">
		<p>
			<label for="user_login"><span><?php _e( 'Username or Email Address' ); // @codingStandardsIgnoreLine.?></span><br />
			<input type="text" name="log" id="user_login"<?php echo wp_kses_post( $loginpress_aria_describedby_error ); ?> class="input" value="<?php echo esc_attr( $loginpress_login_user_login ); ?>" size="20"  autocomplete="off"/></label>
		</p>
		<p>
			<label for="user_pass"><span><?php _e( 'Password' ); // @codingStandardsIgnoreLine.?></span><br />
			<input type="password" name="pwd" id="user_pass"<?php echo wp_kses_post( $loginpress_aria_describedby_error ); ?> class="input" value="" size="20"  autocomplete="off"/></label>
		</p>
		<?php
		/**
		 * Fires following the 'Password' field in the login form.
		 *
		 * @since 2.1.0
		 */
		do_action( 'login_form' );
		/**
		 * Check if rememberme is set.
		 *
		 * @phpstan-ignore-next-line
		 */
		// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the login form.
		if ( isset( $_POST ) ) {
			// phpcs:ignore WordPress.Security.NonceVerification.Missing -- This is the login form.
			$loginpress_rememberme = ! empty( $_POST['rememberme'] );
		} else {
			$loginpress_rememberme = '';
		}
		?>
		<p class="forgetmenot">
			<label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $loginpress_rememberme ); ?> /> <?php esc_html_e( 'Remember Me' ); // @codingStandardsIgnoreLine.?></label>
		</p>
			<p class="submit">
				<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); // @codingStandardsIgnoreLine.?>" />
			</p>
		</form>

		<?php if ( ! $loginpress_interim_login_request ) { ?>
			<p id="nav">
				<?php
				// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- GET parameter for display purposes.
				if ( ! isset( $_GET['checkemail'] ) || ! in_array( sanitize_text_field( wp_unslash( $_GET['checkemail'] ) ), array( 'confirm', 'newpass' ), true ) ) :
					if ( get_option( 'users_can_register' ) ) :
						$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); // @codingStandardsIgnoreLine.

						/** This filter is documented in wp-includes/general-template.php */
						// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Filter output is escaped.
						echo apply_filters( 'register', $registration_url );

						echo esc_html( $loginpress_login_link_separator );
					endif;
					?>
					<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); // @codingStandardsIgnoreLine.?></a>
				<?php endif; ?>
			</p>
			<?php
		}

		login_footer();
		break;
} // end action switch
