Ticket #46349: 46349.2.diff
File 46349.2.diff, 41.4 KB (added by , 5 years ago) |
---|
-
src/wp-admin/css/login.css
131 131 box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13); 132 132 } 133 133 134 .login-action-confirm_admin_email #login { 135 width: 60vw; 136 margin-top: -2vh; 137 } 138 139 @media screen and (max-width: 782px) { 140 .login-action-confirm_admin_email #login { 141 width: 100vw; 142 } 143 } 144 134 145 .login form .forgetmenot { 135 146 font-weight: 400; 136 147 float: left; … … 141 152 float: right; 142 153 } 143 154 155 .login .admin-email-confirm-form .submit { 156 text-align: center; 157 } 158 159 .admin-email__later { 160 text-align: left; 161 } 162 163 .login form p.admin-email__details { 164 margin: 1.1em 0; 165 } 166 167 .login h1.admin-email__heading { 168 border-bottom: 1px rgb(241, 241, 241) solid; 169 color: rgb(95, 95, 95); 170 font-weight: normal; 171 padding-bottom: 0.5em; 172 text-align: left; 173 } 174 175 .admin-email__actions div { 176 padding-top: 1.5em; 177 } 178 179 .login .admin-email__actions .button-primary { 180 float: none; 181 margin-left: 0.25em; 182 margin-right: 0.25em; 183 } 184 144 185 #login form p { 145 186 margin-bottom: 0; 146 187 } -
src/wp-admin/includes/upgrade.php
815 815 upgrade_510(); 816 816 } 817 817 818 if ( $wp_current_db_version < 45744 ) { 819 upgrade_530(); 820 } 821 818 822 maybe_disable_link_manager(); 819 823 820 824 maybe_disable_automattic_widgets(); … … 2115 2119 } 2116 2120 2117 2121 /** 2122 * Executes changes made in WordPress 5.3.0. 2123 * 2124 * @ignore 2125 * @since 5.3.0 2126 */ 2127 function upgrade_530() { 2128 // Do `add_option()` rather than overwriting with `update_option()` as this may run 2129 // after an admin was redirected to the email verification screen, 2130 // and the option was updated. 2131 add_option( 'admin_email_lifespan', 0 ); 2132 } 2133 2134 /** 2118 2135 * Executes network-level upgrade routines. 2119 2136 * 2120 2137 * @since 3.0.0 -
src/wp-includes/version.php
20 20 * 21 21 * @global int $wp_db_version 22 22 */ 23 $wp_db_version = 4 4719;23 $wp_db_version = 45744; 24 24 25 25 /** 26 26 * Holds the TinyMCE version -
src/wp-login.php
55 55 */ 56 56 $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); 57 57 58 if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes ) ) {58 if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) { 59 59 add_action( 'login_head', 'wp_shake_js', 12 ); 60 60 } 61 61 … … 98 98 * This could be added by add_action('login_head'...) like wp_shake_js(), 99 99 * but maybe better if it's not removable by plugins. 100 100 */ 101 if ( 'loggedout' == $wp_error->get_error_code() ) {101 if ( 'loggedout' === $wp_error->get_error_code() ) { 102 102 ?> 103 103 <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script> 104 104 <?php … … 159 159 $login_header_text = apply_filters( 'login_headertext', $login_header_text ); 160 160 161 161 $classes = array( 'login-action-' . $action, 'wp-core-ui' ); 162 162 163 if ( is_rtl() ) { 163 164 $classes[] = 'rtl'; 164 165 } 166 165 167 if ( $interim_login ) { 166 168 $classes[] = 'interim-login'; 169 167 170 ?> 168 171 <style type="text/css">html{background-color: transparent;}</style> 169 172 <?php … … 172 175 $classes[] = 'interim-login-success'; 173 176 } 174 177 } 178 175 179 $classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); 176 180 177 181 /** … … 194 198 * @since 4.6.0 195 199 */ 196 200 do_action( 'login_header' ); 201 197 202 ?> 198 203 <div id="login"> 199 204 <h1><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1> … … 206 211 * @param string $message Login message text. 207 212 */ 208 213 $message = apply_filters( 'login_message', $message ); 214 209 215 if ( ! empty( $message ) ) { 210 216 echo $message . "\n"; 211 217 } … … 219 225 if ( $wp_error->has_errors() ) { 220 226 $errors = ''; 221 227 $messages = ''; 228 222 229 foreach ( $wp_error->get_error_codes() as $code ) { 223 230 $severity = $wp_error->get_error_data( $code ); 224 231 foreach ( $wp_error->get_error_messages( $code ) as $error_message ) { 225 if ( 'message' == $severity ) {232 if ( 'message' === $severity ) { 226 233 $messages .= ' ' . $error_message . "<br />\n"; 227 234 } else { 228 235 $errors .= ' ' . $error_message . "<br />\n"; … … 229 236 } 230 237 } 231 238 } 239 232 240 if ( ! empty( $errors ) ) { 233 241 /** 234 242 * Filters the error messages displayed above the login form. … … 239 247 */ 240 248 echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n"; 241 249 } 250 242 251 if ( ! empty( $messages ) ) { 243 252 /** 244 253 * Filters instructional messages displayed above the login form. … … 263 272 global $interim_login; 264 273 265 274 // Don't allow interim logins to navigate away from the page. 266 if ( ! $interim_login ) :275 if ( ! $interim_login ) { 267 276 ?> 268 <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>">277 <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"> 269 278 <?php 279 270 280 /* translators: %s: site title */ 271 281 printf( _x( '← Back to %s', 'site' ), get_bloginfo( 'title', 'display' ) ); 282 272 283 ?> 273 </a></p> 274 <?php the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' ); ?> 275 <?php endif; ?> 284 </a></p> 285 <?php 276 286 277 </div> 287 the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' ); 288 } 278 289 279 <?php if ( ! empty( $input_id ) ) : ?> 280 <script type="text/javascript"> 281 try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){} 282 if(typeof wpOnload=='function')wpOnload(); 283 </script> 284 <?php endif; ?> 290 ?> 291 </div><?php // End of <div id="login"> ?> 285 292 286 293 <?php 294 295 if ( ! empty( $input_id ) ) { 296 ?> 297 <script type="text/javascript"> 298 try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){} 299 if(typeof wpOnload=='function')wpOnload(); 300 </script> 301 <?php 302 } 303 287 304 /** 288 305 * Fires in the login page footer. 289 306 * … … 290 307 * @since 3.1.0 291 308 */ 292 309 do_action( 'login_footer' ); 310 293 311 ?> 294 312 <div class="clear"></div> 295 313 </body> … … 304 322 */ 305 323 function wp_shake_js() { 306 324 ?> 307 <script type="text/javascript">308 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};309 function s(id,pos){g(id).left=pos+'px';}310 function g(id){return document.getElementById(id).style;}311 function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}}312 addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);});313 </script>325 <script type="text/javascript"> 326 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}; 327 function s(id,pos){g(id).left=pos+'px';} 328 function g(id){return document.getElementById(id).style;} 329 function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}} 330 addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);}); 331 </script> 314 332 <?php 315 333 } 316 334 … … 452 470 $action = 'resetpass'; 453 471 } 454 472 473 $default_actions = array( 474 'confirm_admin_email', 475 'postpass', 476 'logout', 477 'lostpassword', 478 'retrievepassword', 479 'resetpass', 480 'rp', 481 'register', 482 'login', 483 'confirmaction', 484 WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED, 485 ); 486 455 487 // Validate action so as to default to the login screen. 456 if ( ! in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login', 'confirmaction', WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED ), true ) && false === has_filter( 'login_form_' . $action ) ) {488 if ( ! in_array( $action, $default_actions, true ) && false === has_filter( 'login_form_' . $action ) ) { 457 489 $action = 'login'; 458 490 } 459 491 … … 462 494 header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) ); 463 495 464 496 if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set 465 if ( isset( $_SERVER['PATH_INFO'] ) && ( $_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF'] ) ) {497 if ( isset( $_SERVER['PATH_INFO'] ) && ( $_SERVER['PATH_INFO'] !== $_SERVER['PHP_SELF'] ) ) { 466 498 $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] ); 467 499 } 468 500 469 501 $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); 470 if ( $url != get_option( 'siteurl' ) ) { 502 503 if ( $url !== get_option( 'siteurl' ) ) { 471 504 update_option( 'siteurl', $url ); 472 505 } 473 506 } … … 475 508 //Set a cookie now to see if they are supported by the browser. 476 509 $secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) ); 477 510 setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); 511 478 512 if ( SITECOOKIEPATH != COOKIEPATH ) { 479 513 setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); 480 514 } … … 497 531 */ 498 532 do_action( "login_form_{$action}" ); 499 533 500 $http_post = ( 'POST' == $_SERVER['REQUEST_METHOD'] );534 $http_post = ( 'POST' === $_SERVER['REQUEST_METHOD'] ); 501 535 $interim_login = isset( $_REQUEST['interim-login'] ); 502 536 503 537 /** … … 511 545 512 546 switch ( $action ) { 513 547 548 case 'confirm_admin_email': 549 // Note that `is_user_logged_in()` will return false immediately after logging in 550 // as the current user is not set, see wp-includes/pluggable.php. 551 // However this action runs on a redirect after logging in. 552 if ( ! is_user_logged_in() ) { 553 wp_safe_redirect( wp_login_url() ); 554 exit; 555 } 556 557 if ( ! empty( $_REQUEST['redirect_to'] ) ) { 558 $redirect_to = $_REQUEST['redirect_to']; 559 } else { 560 $redirect_to = admin_url(); 561 } 562 563 if ( current_user_can( 'manage_options' ) ) { 564 $admin_email = get_option( 'admin_email' ); 565 } else { 566 wp_safe_redirect( $redirect_to ); 567 exit; 568 } 569 570 if ( ! empty( $_GET['remind_me_later'] ) ) { 571 if ( ! wp_verify_nonce( $_GET['remind_me_later'], 'remind_me_later_nonce' ) ) { 572 wp_safe_redirect( wp_login_url() ); 573 exit; 574 } 575 576 // "Remind me later" is a bit ambiguous. Three days later? 577 update_option( 'admin_email_lifespan', time() + 3 * DAY_IN_SECONDS ); 578 579 wp_safe_redirect( $redirect_to ); 580 exit; 581 } 582 583 if ( ! empty( $_POST['correct-admin-email'] ) ) { 584 if ( ! check_admin_referer( 'confirm_admin_email', 'confirm_admin_email_nonce' ) ) { 585 wp_safe_redirect( wp_login_url() ); 586 exit; 587 } 588 589 /** 590 * Filters the interval for redirecting the user to the admin email confirmation screen. 591 * If `0` (zero) is returned, the user will not be redirected. 592 * 593 * @since 5.3.0 594 * 595 * @param int Interval time (in seconds). 596 */ 597 $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 180 * DAY_IN_SECONDS ); 598 599 if ( $admin_email_check_interval > 0 ) { 600 update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); 601 } 602 603 wp_safe_redirect( $redirect_to ); 604 exit; 605 } 606 607 login_header( __( 'Confirm your admin email' ), '', $errors ); 608 609 /** 610 * Fires before the admin email confirm form. 611 * 612 * @since 5.3.0 613 * 614 * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid credentials. Note that the error object may not contain any errors. 615 */ 616 do_action( 'admin_email_confirm', $errors ); 617 618 ?> 619 620 <form class="admin-email-confirm-form" name="admin-email-confirm-form" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=confirm_admin_email', 'login_post' ) ); ?>" method="post"> 621 <?php 622 /** 623 * Fires inside the admin-email-confirm-form form tags, before the hidden fields. 624 * 625 * @since 5.3.0 626 */ 627 do_action( 'admin_email_confirm_form' ); 628 629 wp_nonce_field( 'confirm_admin_email', 'confirm_admin_email_nonce' ); 630 631 ?> 632 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 633 634 <h1 class="admin-email__heading"> 635 <?php _e( 'Administration email verification' ); ?> 636 </h1> 637 <p class="admin-email__details"> 638 <?php _e( 'Please verify that the <strong>administration email</strong> for this website is still correct.' ); ?> 639 <?php 640 641 // TO-DO 642 /* translators: URL to help page about admin email. */ 643 $admin_email_help_url = __( 'https://wordpress.org/support/article/administration-email/' ); 644 645 printf( 646 '<a href="%s" rel="noopener noreferrer" target="_blank">%s</a>', 647 esc_url( $admin_email_help_url ), 648 __( 'Why is this important?' ) 649 ); 650 651 ?> 652 </p> 653 <p class="admin-email__details"> 654 <?php 655 656 printf( 657 __( 'Current administration email: <strong>%s</strong>' ), 658 esc_html( $admin_email ) 659 ); 660 661 ?> 662 </p> 663 <p class="admin-email__details"> 664 <?php _e( 'This email may be different from your personal email address.' ); ?> 665 <?php 666 667 printf( 668 '<a href="%s" rel="noopener noreferrer" target="_blank">%s</a>', 669 esc_url( $admin_email_help_url ), 670 __( 'Learn more.' ) 671 ); 672 673 ?> 674 </p> 675 676 <div class="admin-email__actions"> 677 <div class="admin-email__actions-primary"> 678 <?php 679 680 $change_link = admin_url( 'options-general.php' ); 681 $change_link = add_query_arg( 'highlight', 'confirm_admin_email', $change_link ); 682 683 ?> 684 <a class="button button-large" href="<?php echo esc_url( $change_link ); ?>"><?php _e( 'Update' ); ?></a> 685 <input type="submit" name="correct-admin-email" id="correct-admin-email" class="button button-primary button-large" value="<?php esc_attr_e( 'The email is correct' ); ?>" /> 686 </div> 687 <div class="admin-email__actions-secondary"> 688 <?php 689 690 $remind_me_link = wp_login_url( $redirect_to ); 691 $remind_me_link = add_query_arg( 692 array( 693 'action' => 'confirm_admin_email', 694 'remind_me_later' => wp_create_nonce( 'remind_me_later_nonce' ), 695 ), 696 $remind_me_link 697 ); 698 699 ?> 700 <a href="<?php echo esc_url( $remind_me_link ); ?>"><?php _e( 'Remind me later' ); ?></a> 701 </div> 702 </div> 703 </form> 704 705 <?php 706 707 login_footer(); 708 break; 709 514 710 case 'postpass': 515 711 if ( ! array_key_exists( 'post_password', $_POST ) ) { 516 712 wp_safe_redirect( wp_get_referer() ); 517 exit ();713 exit; 518 714 } 519 715 520 716 require_once ABSPATH . WPINC . '/class-phpass.php'; … … 532 728 */ 533 729 $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS ); 534 730 $referer = wp_get_referer(); 731 535 732 if ( $referer ) { 536 733 $secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) ); 537 734 } else { 538 735 $secure = false; 539 736 } 737 540 738 setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); 541 739 542 740 wp_safe_redirect( wp_get_referer() ); … … 553 751 $redirect_to = $_REQUEST['redirect_to']; 554 752 $requested_redirect_to = $redirect_to; 555 753 } else { 556 $redirect_to 754 $redirect_to = add_query_arg( 557 755 array( 558 756 'loggedout' => 'true', 559 757 'wp_lang' => get_user_locale( $user ), … … 560 758 ), 561 759 wp_login_url() 562 760 ); 761 563 762 $requested_redirect_to = ''; 564 763 } 565 764 … … 573 772 * @param WP_User $user The WP_User object for the user that's logging out. 574 773 */ 575 774 $redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user ); 775 576 776 wp_safe_redirect( $redirect_to ); 577 777 exit(); 578 778 … … 580 780 case 'retrievepassword': 581 781 if ( $http_post ) { 582 782 $errors = retrieve_password(); 783 583 784 if ( ! is_wp_error( $errors ) ) { 584 785 $redirect_to = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; 585 786 wp_safe_redirect( $redirect_to ); … … 588 789 } 589 790 590 791 if ( isset( $_GET['error'] ) ) { 591 if ( 'invalidkey' == $_GET['error'] ) {792 if ( 'invalidkey' === $_GET['error'] ) { 592 793 $errors->add( 'invalidkey', __( 'Your password reset link appears to be invalid. Please request a new link below.' ) ); 593 } elseif ( 'expiredkey' == $_GET['error'] ) {794 } elseif ( 'expiredkey' === $_GET['error'] ) { 594 795 $errors->add( 'expiredkey', __( 'Your password reset link has expired. Please request a new link below.' ) ); 595 796 } 596 797 } … … 626 827 627 828 ?> 628 829 629 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> 630 <p> 631 <label for="user_login" ><?php _e( 'Username or Email Address' ); ?><br /> 632 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /></label> 633 </p> 634 <?php 635 /** 636 * Fires inside the lostpassword form tags, before the hidden fields. 637 * 638 * @since 2.1.0 639 */ 640 do_action( 'lostpassword_form' ); 641 ?> 642 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 643 <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' ); ?>" /></p> 644 </form> 830 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> 831 <p> 832 <label for="user_login" ><?php _e( 'Username or Email Address' ); ?><br /> 833 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /></label> 834 </p> 835 <?php 645 836 646 <p id="nav"> 647 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 648 <?php 649 if ( get_option( 'users_can_register' ) ) : 650 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 837 /** 838 * Fires inside the lostpassword form tags, before the hidden fields. 839 * 840 * @since 2.1.0 841 */ 842 do_action( 'lostpassword_form' ); 651 843 652 echo esc_html( $login_link_separator ); 844 ?> 845 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 846 <p class="submit"> 847 <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> 849 </form> 653 850 654 /** This filter is documented in wp-includes/general-template.php */ 655 echo apply_filters( 'register', $registration_url ); 656 endif; 657 ?> 658 </p> 851 <p id="nav"> 852 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 853 <?php 659 854 855 if ( get_option( 'users_can_register' ) ) { 856 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 857 858 echo esc_html( $login_link_separator ); 859 860 /** This filter is documented in wp-includes/general-template.php */ 861 echo apply_filters( 'register', $registration_url ); 862 } 863 864 ?> 865 </p> 660 866 <?php 867 661 868 login_footer( 'user_login' ); 662 663 869 break; 664 870 665 871 case 'resetpass': … … 666 872 case 'rp': 667 873 list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); 668 874 $rp_cookie = 'wp-resetpass-' . COOKIEHASH; 875 669 876 if ( isset( $_GET['key'] ) ) { 670 877 $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) ); 671 878 setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); 879 672 880 wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) ); 673 881 exit; 674 882 } … … 675 883 676 884 if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { 677 885 list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); 678 $user = check_password_reset_key( $rp_key, $rp_login ); 886 887 $user = check_password_reset_key( $rp_key, $rp_login ); 888 679 889 if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) { 680 890 $user = false; 681 891 } … … 685 895 686 896 if ( ! $user || is_wp_error( $user ) ) { 687 897 setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); 898 688 899 if ( $user && $user->get_error_code() === 'expired_key' ) { 689 900 wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); 690 901 } else { 691 902 wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); 692 903 } 904 693 905 exit; 694 906 } 695 907 … … 723 935 login_header( __( 'Reset Password' ), '<p class="message reset-pass">' . __( 'Enter your new password below.' ) . '</p>', $errors ); 724 936 725 937 ?> 726 <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">727 <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />938 <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> 939 <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" /> 728 940 729 <div class="user-pass1-wrap">730 <p>731 <label for="pass1"><?php _e( 'New password' ); ?></label>732 </p>941 <div class="user-pass1-wrap"> 942 <p> 943 <label for="pass1"><?php _e( 'New password' ); ?></label> 944 </p> 733 945 734 <div class="wp-pwd"> 735 <div class="password-input-wrapper"> 736 <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="off" aria-describedby="pass-strength-result" /> 737 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js"> 738 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> 739 </button> 946 <div class="wp-pwd"> 947 <div class="password-input-wrapper"> 948 <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="off" aria-describedby="pass-strength-result" /> 949 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js"> 950 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> 951 </button> 952 </div> 953 <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> 954 </div> 955 <div class="pw-weak"> 956 <label> 957 <input type="checkbox" name="pw_weak" class="pw-checkbox" /> 958 <?php _e( 'Confirm use of weak password' ); ?> 959 </label> 960 </div> 740 961 </div> 741 <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div>742 </div>743 <div class="pw-weak">744 <label>745 <input type="checkbox" name="pw_weak" class="pw-checkbox" />746 <?php _e( 'Confirm use of weak password' ); ?>747 </label>748 </div>749 </div>750 962 751 <p class="user-pass2-wrap">752 <label for="pass2"><?php _e( 'Confirm new password' ); ?></label><br />753 <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" />754 </p>963 <p class="user-pass2-wrap"> 964 <label for="pass2"><?php _e( 'Confirm new password' ); ?></label><br /> 965 <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /> 966 </p> 755 967 756 <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>757 <br class="clear" />968 <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p> 969 <br class="clear" /> 758 970 759 <?php 760 /** 761 * Fires following the 'Strength indicator' meter in the user password reset form. 762 * 763 * @since 3.9.0 764 * 765 * @param WP_User $user User object of the user whose password is being reset. 766 */ 767 do_action( 'resetpass_form', $user ); 768 ?> 769 <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> 770 <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Reset Password' ); ?>" /></p> 771 </form> 971 <?php 772 972 773 <p id="nav"> 774 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 775 <?php 776 if ( get_option( 'users_can_register' ) ) : 777 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 973 /** 974 * Fires following the 'Strength indicator' meter in the user password reset form. 975 * 976 * @since 3.9.0 977 * 978 * @param WP_User $user User object of the user whose password is being reset. 979 */ 980 do_action( 'resetpass_form', $user ); 778 981 779 echo esc_html( $login_link_separator ); 982 ?> 983 <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> 984 <p class="submit"> 985 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Reset Password' ); ?>" /> 986 </p> 987 </form> 780 988 781 /** This filter is documented in wp-includes/general-template.php */ 782 echo apply_filters( 'register', $registration_url ); 783 endif; 784 ?> 785 </p> 989 <p id="nav"> 990 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 991 <?php 786 992 993 if ( get_option( 'users_can_register' ) ) { 994 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 995 996 echo esc_html( $login_link_separator ); 997 998 /** This filter is documented in wp-includes/general-template.php */ 999 echo apply_filters( 'register', $registration_url ); 1000 } 1001 1002 ?> 1003 </p> 787 1004 <?php 1005 788 1006 login_footer( 'user_pass' ); 789 790 1007 break; 791 1008 792 1009 case 'register': … … 820 1037 } 821 1038 822 1039 $errors = register_new_user( $user_login, $user_email ); 1040 823 1041 if ( ! is_wp_error( $errors ) ) { 824 1042 $redirect_to = ! empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; 825 1043 wp_safe_redirect( $redirect_to ); … … 828 1046 } 829 1047 830 1048 $registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; 1049 831 1050 /** 832 1051 * Filters the registration redirect URL. 833 1052 * … … 836 1055 * @param string $registration_redirect The redirect destination URL. 837 1056 */ 838 1057 $redirect_to = apply_filters( 'registration_redirect', $registration_redirect ); 1058 839 1059 login_header( __( 'Registration Form' ), '<p class="message register">' . __( 'Register For This Site' ) . '</p>', $errors ); 1060 840 1061 ?> 841 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> 842 <p> 843 <label for="user_login"><?php _e( 'Username' ); ?><br /> 844 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" /></label> 845 </p> 846 <p> 847 <label for="user_email"><?php _e( 'Email' ); ?><br /> 848 <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label> 849 </p> 850 <?php 851 /** 852 * Fires following the 'Email' field in the user registration form. 853 * 854 * @since 2.1.0 855 */ 856 do_action( 'register_form' ); 857 ?> 858 <p id="reg_passmail"><?php _e( 'Registration confirmation will be emailed to you.' ); ?></p> 859 <br class="clear" /> 860 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 861 <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" /></p> 862 </form> 1062 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> 1063 <p> 1064 <label for="user_login"><?php _e( 'Username' ); ?><br /> 1065 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" /></label> 1066 </p> 1067 <p> 1068 <label for="user_email"><?php _e( 'Email' ); ?><br /> 1069 <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label> 1070 </p> 1071 <?php 863 1072 864 <p id="nav"> 865 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 866 <?php echo esc_html( $login_link_separator ); ?> 867 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> 868 </p> 1073 /** 1074 * Fires following the 'Email' field in the user registration form. 1075 * 1076 * @since 2.1.0 1077 */ 1078 do_action( 'register_form' ); 869 1079 1080 ?> 1081 <p id="reg_passmail"> 1082 <?php _e( 'Registration confirmation will be emailed to you.' ); ?> 1083 </p> 1084 <br class="clear" /> 1085 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 1086 <p class="submit"> 1087 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" /> 1088 </p> 1089 </form> 1090 1091 <p id="nav"> 1092 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 1093 <?php echo esc_html( $login_link_separator ); ?> 1094 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> 1095 </p> 870 1096 <?php 1097 871 1098 login_footer( 'user_login' ); 872 873 1099 break; 874 1100 875 1101 case 'confirmaction': … … 914 1140 default: 915 1141 $secure_cookie = ''; 916 1142 $customize_login = isset( $_REQUEST['customize-login'] ); 1143 917 1144 if ( $customize_login ) { 918 1145 wp_enqueue_script( 'customize-base' ); 919 1146 } … … 990 1217 $message = '<p class="message">' . __( 'You have logged in successfully.' ) . '</p>'; 991 1218 $interim_login = 'success'; 992 1219 login_header( '', $message ); 1220 993 1221 ?> 994 1222 </div> 995 1223 <?php 1224 996 1225 /** This action is documented in wp-login.php */ 997 1226 do_action( 'login_footer' ); 1227 1228 if ( $customize_login ) { 1229 ?> 1230 <script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script> 1231 <?php 1232 } 1233 998 1234 ?> 999 <?php if ( $customize_login ) : ?>1000 <script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>1001 <?php endif; ?>1002 1235 </body></html> 1003 1236 <?php 1237 1004 1238 exit; 1005 1239 } 1006 1240 1007 if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) { 1241 // Check if it is time to add a redirect to the admin email confirmation screen. 1242 if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) { 1243 $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); 1244 1245 // If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected 1246 // to the admin email confirmation screen. 1247 /** This filter is documented in wp-login.php */ 1248 $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 180 * DAY_IN_SECONDS ); 1249 1250 if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) { 1251 $redirect_to = add_query_arg( 'action', 'confirm_admin_email', wp_login_url( $redirect_to ) ); 1252 } 1253 } 1254 1255 if ( ( empty( $redirect_to ) || $redirect_to === 'wp-admin/' || $redirect_to == admin_url() ) ) { 1008 1256 // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile. 1009 1257 if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) { 1010 1258 $redirect_to = user_admin_url(); … … 1015 1263 } 1016 1264 1017 1265 wp_redirect( $redirect_to ); 1018 exit ();1266 exit; 1019 1267 } 1268 1020 1269 wp_safe_redirect( $redirect_to ); 1021 exit ();1270 exit; 1022 1271 } 1023 1272 1024 1273 $errors = $user; … … 1037 1286 } 1038 1287 } else { 1039 1288 // Some parts of this script use the main login form to display a message. 1040 if ( isset( $_GET['loggedout'] ) && true ==$_GET['loggedout'] ) {1289 if ( isset( $_GET['loggedout'] ) && $_GET['loggedout'] ) { 1041 1290 $errors->add( 'loggedout', __( 'You are now logged out.' ), 'message' ); 1042 } elseif ( isset( $_GET['registration'] ) && 'disabled' == $_GET['registration'] ) {1291 } elseif ( isset( $_GET['registration'] ) && 'disabled' === $_GET['registration'] ) { 1043 1292 $errors->add( 'registerdisabled', __( 'User registration is currently not allowed.' ) ); 1044 } elseif ( isset( $_GET['checkemail'] ) && 'confirm' == $_GET['checkemail'] ) {1293 } elseif ( isset( $_GET['checkemail'] ) && 'confirm' === $_GET['checkemail'] ) { 1045 1294 $errors->add( 'confirm', __( 'Check your email for the confirmation link.' ), 'message' ); 1046 } elseif ( isset( $_GET['checkemail'] ) && 'newpass' == $_GET['checkemail'] ) {1295 } elseif ( isset( $_GET['checkemail'] ) && 'newpass' === $_GET['checkemail'] ) { 1047 1296 $errors->add( 'newpass', __( 'Check your email for your new password.' ), 'message' ); 1048 } elseif ( isset( $_GET['checkemail'] ) && 'registered' == $_GET['checkemail'] ) {1297 } elseif ( isset( $_GET['checkemail'] ) && 'registered' === $_GET['checkemail'] ) { 1049 1298 $errors->add( 'registered', __( 'Registration complete. Please check your email.' ), 'message' ); 1050 1299 } elseif ( strpos( $redirect_to, 'about.php?updated' ) ) { 1051 1300 $errors->add( 'updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); … … 1072 1321 login_header( __( 'Log In' ), '', $errors ); 1073 1322 1074 1323 if ( isset( $_POST['log'] ) ) { 1075 $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password'== $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : '';1324 $user_login = ( 'incorrect_password' === $errors->get_error_code() || 'empty_password' === $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : ''; 1076 1325 } 1326 1077 1327 $rememberme = ! empty( $_POST['rememberme'] ); 1078 1328 1079 1329 if ( $errors->has_errors() ) { … … 1081 1331 } else { 1082 1332 $aria_describedby_error = ''; 1083 1333 } 1084 ?>1085 1334 1086 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">1087 <p>1088 <label for="user_login"><?php _e( 'Username or Email Address' ); ?><br />1089 <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" /></label>1090 </p>1091 <p>1092 <label for="user_pass"><?php _e( 'Password' ); ?><br />1093 <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input" value="" size="20" /></label>1094 </p>1095 <?php1096 /**1097 * Fires following the 'Password' field in the login form.1098 *1099 * @since 2.1.01100 */1101 do_action( 'login_form' );1102 1335 ?> 1103 <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_html_e( 'Remember Me' ); ?></label></p>1104 <p class="submit">1105 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); ?>" />1106 <?php if ( $interim_login ) { ?>1107 <input type="hidden" name="interim-login" value="1" />1108 <?php } else { ?>1109 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />1110 <?php } ?>1111 <?php if ( $customize_login ) : ?>1112 <input type="hidden" name="customize-login" value="1" />1113 <?php endif; ?>1114 <input type="hidden" name="testcookie" value="1" />1115 </p>1116 </form>1117 1336 1118 <?php if ( ! $interim_login ) { ?> 1119 <p id="nav"> 1337 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> 1338 <p> 1339 <label for="user_login"><?php _e( 'Username or Email Address' ); ?><br /> 1340 <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" /></label> 1341 </p> 1342 <p> 1343 <label for="user_pass"><?php _e( 'Password' ); ?><br /> 1344 <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input" value="" size="20" /></label> 1345 </p> 1120 1346 <?php 1121 if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) :1122 if ( get_option( 'users_can_register' ) ) :1123 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );1124 1347 1125 /** This filter is documented in wp-includes/general-template.php */ 1126 echo apply_filters( 'register', $registration_url ); 1348 /** 1349 * Fires following the 'Password' field in the login form. 1350 * 1351 * @since 2.1.0 1352 */ 1353 do_action( 'login_form' ); 1127 1354 1128 echo esc_html( $login_link_separator ); 1129 endif; 1355 ?> 1356 <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_html_e( 'Remember Me' ); ?></label></p> 1357 <p class="submit"> 1358 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); ?>" /> 1359 <?php 1360 1361 if ( $interim_login ) { 1362 ?> 1363 <input type="hidden" name="interim-login" value="1" /> 1364 <?php 1365 } else { 1366 ?> 1367 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 1368 <?php 1369 } 1370 1371 if ( $customize_login ) { 1372 ?> 1373 <input type="hidden" name="customize-login" value="1" /> 1374 <?php 1375 } 1376 1130 1377 ?> 1131 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> 1132 <?php endif; ?> 1133 </p> 1134 <?php } ?> 1378 <input type="hidden" name="testcookie" value="1" /> 1379 </p> 1380 </form> 1135 1381 1136 <script type="text/javascript"> 1137 function wp_attempt_focus(){ 1138 setTimeout( function(){ try{ 1139 <?php if ( $user_login ) { ?> 1140 d = document.getElementById('user_pass'); 1141 d.value = ''; 1142 <?php } else { ?> 1143 d = document.getElementById('user_login'); 1144 <?php if ( 'invalid_username' == $errors->get_error_code() ) { ?> 1145 if( d.value != '' ) 1146 d.value = ''; 1382 <?php 1383 1384 if ( ! $interim_login ) { 1385 ?> 1386 <p id="nav"> 1147 1387 <?php 1388 1389 if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ), true ) ) { 1390 if ( get_option( 'users_can_register' ) ) { 1391 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 1392 1393 /** This filter is documented in wp-includes/general-template.php */ 1394 echo apply_filters( 'register', $registration_url ); 1395 1396 echo esc_html( $login_link_separator ); 1397 } 1398 1399 ?> 1400 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> 1401 <?php 1402 } 1403 1404 ?> 1405 </p> 1406 <?php 1407 } 1408 1409 $login_script = 'function wp_attempt_focus() {'; 1410 $login_script .= 'setTimeout( function() {'; 1411 $login_script .= 'try {'; 1412 1413 if ( $user_login ) { 1414 $login_script .= 'd = document.getElementById( "user_pass" ); d.value = "";'; 1415 } else { 1416 $login_script .= 'd = document.getElementById( "user_login" );'; 1417 1418 if ( $errors->get_error_code() === 'invalid_username' ) { 1419 $login_script .= 'd.value = "";'; 1148 1420 } 1149 } 1150 ?> 1151 d.focus(); 1152 d.select(); 1153 } catch(e){} 1154 }, 200); 1155 } 1421 } 1156 1422 1157 <?php 1423 $login_script .= 'd.focus(); d.select();'; 1424 $login_script .= '} catch( er ) {}'; 1425 $login_script .= '}, 200);'; 1426 $login_script .= "}\n"; // End of wp_attempt_focus(). 1427 1158 1428 /** 1159 1429 * Filters whether to print the call to `wp_attempt_focus()` on the login screen. 1160 1430 * … … 1163 1433 * @param bool $print Whether to print the function call. Default true. 1164 1434 */ 1165 1435 if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) { 1436 $login_script .= "wp_attempt_focus();\n"; 1437 } 1438 1439 // Run `wpOnload()` if defined. 1440 $login_script .= "if ( typeof wpOnload === 'function' ) { wpOnload() }"; 1441 1442 ?> 1443 <script type="text/javascript"> 1444 <?php echo $login_script; ?> 1445 </script> 1446 <?php 1447 1448 if ( $interim_login ) { 1166 1449 ?> 1167 wp_attempt_focus(); 1168 <?php } ?> 1169 if(typeof wpOnload=='function')wpOnload(); 1170 <?php if ( $interim_login ) { ?> 1171 (function(){ 1172 try { 1173 var i, links = document.getElementsByTagName('a'); 1174 for ( i in links ) { 1175 if ( links[i].href ) 1176 links[i].target = '_blank'; 1450 <script type="text/javascript"> 1451 ( function() { 1452 try { 1453 var i, links = document.getElementsByTagName( 'a' ); 1454 for ( i in links ) { 1455 if ( links[i].href ) { 1456 links[i].target = '_blank'; 1457 links[i].rel = 'noreferrer noopener'; 1458 } 1459 } 1460 } catch( er ) {} 1461 }()); 1462 </script> 1463 <?php 1177 1464 } 1178 } catch(e){}1179 }());1180 <?php } ?>1181 </script>1182 1465 1183 <?php1184 1466 login_footer(); 1185 1186 1467 break; 1187 1468 } // End action switch.