wp_admin_css( 'colors-fresh', true );
if ( wp_is_mobile() ) { ?>
- <meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" /><?php
+ <meta name="viewport" content="width=320, initial-scale=0.9, maximum-scale=1.0, user-scalable=0" /><?php
+ }
+
+ // Remove all stored post data on logging out.
+ // This could be added by add_action('login_head'...) like wp_shake_js()
+ // but maybe better if it's not removable by plugins
+ if ( 'loggedout' == $wp_error->get_error_code() ) {
+ ?>
+ <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
+ <?php
}
do_action( 'login_enqueue_scripts' );
$login_header_url = apply_filters( 'login_headerurl', $login_header_url );
$login_header_title = apply_filters( 'login_headertitle', $login_header_title );
- // Don't allow interim logins to navigate away from the page.
- if ( $interim_login )
- $login_header_url = '#';
-
$classes = array( 'login-action-' . $action, 'wp-core-ui' );
if ( wp_is_mobile() )
$classes[] = 'mobile';
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 = apply_filters( 'login_body_class', $classes, $action );
+
?>
</head>
<body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
$message = apply_filters('retrieve_password_message', $message, $key);
if ( $message && !wp_mail($user_email, $title, $message) )
- wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') );
+ wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.') );
return true;
}
$user_pass = wp_generate_password( 12, false);
$user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
if ( ! $user_id ) {
- $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
+ $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn’t register you… please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
return $errors;
}
do_action( 'login_form_' . $action );
$http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
+$interim_login = isset($_REQUEST['interim-login']);
+
switch ($action) {
case 'postpass' :
- if ( empty( $wp_hasher ) ) {
- require_once( ABSPATH . 'wp-includes/class-phpass.php' );
- // By default, use the portable hash from phpass
- $wp_hasher = new PasswordHash(8, true);
- }
+ require_once ABSPATH . 'wp-includes/class-phpass.php';
+ $hasher = new PasswordHash( 8, true );
// 10 days
- setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH );
+ setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), time() + 10 * DAY_IN_SECONDS, COOKIEPATH );
wp_safe_redirect( wp_get_referer() );
exit();
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>', $errors);
- $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
+ $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
?>
<p id="nav">
<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a>
<?php if ( get_option( 'users_can_register' ) ) : ?>
- | <a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ?></a>
+ | <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ) ); ?>
<?php endif; ?>
</p>
login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
?>
-<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( site_url( 'wp-login.php?action=resetpass&key=' . urlencode( $_GET['key'] ) . '&login=' . urlencode( $_GET['login'] ), 'login_post' ) ); ?>" method="post">
+<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( site_url( 'wp-login.php?action=resetpass&key=' . urlencode( $_GET['key'] ) . '&login=' . urlencode( $_GET['login'] ), 'login_post' ) ); ?>" method="post" autocomplete="off">
<input type="hidden" id="user_login" value="<?php echo esc_attr( $_GET['login'] ); ?>" autocomplete="off" />
<p>
<p id="nav">
<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
<?php if ( get_option( 'users_can_register' ) ) : ?>
- | <a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ?></a>
+ | <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ) ); ?>
<?php endif; ?>
</p>
<form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post">
<p>
<label for="user_login"><?php _e('Username') ?><br />
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" /></label>
+ <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label>
</p>
<p>
<label for="user_email"><?php _e('E-mail') ?><br />
- <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" /></label>
+ <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(wp_unslash($user_email)); ?>" size="25" /></label>
</p>
<?php do_action('register_form'); ?>
<p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
case 'login' :
default:
$secure_cookie = '';
- $interim_login = isset($_REQUEST['interim-login']);
$customize_login = isset( $_REQUEST['customize-login'] );
if ( $customize_login )
wp_enqueue_script( 'customize-base' );
if ( !is_wp_error($user) && !$reauth ) {
if ( $interim_login ) {
$message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
+ $interim_login = 'success';
login_header( '', $message ); ?>
-
- <?php if ( ! $customize_login ) : ?>
- <script type="text/javascript">setTimeout( function(){window.close()}, 8000);</script>
- <p class="alignright">
- <input type="button" class="button-primary" value="<?php esc_attr_e('Close'); ?>" onclick="window.close()" /></p>
- <?php endif; ?>
</div>
<?php do_action( 'login_footer' ); ?>
<?php if ( $customize_login ) : ?>
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."));
- // 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', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to experience the awesomeness.' ), 'message' );
+ 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');
+ } 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 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 ( strpos( $redirect_to, 'about.php?updated' ) )
+ $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to experience the awesomeness.' ), 'message' );
+ }
+
+ $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
// Clear any stale cookies.
if ( $reauth )
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'] );
?>
</p>
</form>
-<?php if ( !$interim_login ) { ?>
+<?php if ( ! $interim_login ) { ?>
<p id="nav">
-<?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
-<?php elseif ( get_option('users_can_register') ) : ?>
-<a href="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login' ) ); ?>"><?php _e( 'Register' ); ?></a> |
-<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
-<?php else : ?>
-<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
+<?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : ?>
+ <?php if ( get_option( 'users_can_register' ) ) : ?>
+ <?php echo apply_filters( 'register', sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ) ); ?> |
+ <?php endif; ?>
+ <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
<?php endif; ?>
</p>
<?php } ?>
wp_attempt_focus();
<?php } ?>
if(typeof wpOnload=='function')wpOnload();
+<?php if ( $interim_login ) { ?>
+(function(){
+try {
+ var i, links = document.getElementsByTagName('a');
+ for ( i in links ) {
+ if ( links[i].href )
+ links[i].target = '_blank';
+ }
+} catch(e){}
+}());
+<?php } ?>
</script>
<?php