Ticket #46349: 46349.1.diff
File 46349.1.diff, 36.8 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(); … … 2118 2122 } 2119 2123 2120 2124 /** 2125 * Executes changes made in WordPress 5.3.0. 2126 * 2127 * @ignore 2128 * @since 5.3.0 2129 */ 2130 function upgrade_530() { 2131 // Do `add_option()` rather than overwriting with `update_option()` as this may run 2132 // after an admin was redirected to the email verification screen, 2133 // and the option was updated. 2134 add_option( 'admin_email_lifespan', 0 ); 2135 } 2136 2137 /** 2121 2138 * Executes network-level upgrade routines. 2122 2139 * 2123 2140 * @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
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 ) { … … 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', 'logout', 476 'lostpassword', 477 'retrievepassword', 478 'resetpass', 479 'rp', 480 'register', 481 'login', 482 'confirmaction', 483 WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED, 484 ); 485 455 486 // 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 ) ) {487 if ( ! in_array( $action, $default_actions, true ) && false === has_filter( 'login_form_' . $action ) ) { 457 488 $action = 'login'; 458 489 } 459 490 … … 467 498 } 468 499 469 500 $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); 501 470 502 if ( $url != get_option( 'siteurl' ) ) { 471 503 update_option( 'siteurl', $url ); 472 504 } … … 475 507 //Set a cookie now to see if they are supported by the browser. 476 508 $secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) ); 477 509 setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); 510 478 511 if ( SITECOOKIEPATH != COOKIEPATH ) { 479 512 setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); 480 513 } … … 511 544 512 545 switch ( $action ) { 513 546 547 case 'confirm_admin_email': 548 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 ( ! check_admin_referer( 'confirm_admin_email', 'confirm_admin_email_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 update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); 600 601 wp_safe_redirect( $redirect_to ); 602 exit; 603 } 604 605 login_header( __( 'Confirm your admin email' ), '', $errors ); 606 607 /** 608 * Fires before the admin email confirm form. 609 * 610 * @since 5.3.0 611 * 612 * @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. 613 */ 614 do_action( 'admin_email_confirm', $errors ); 615 616 ?> 617 618 <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"> 619 <?php 620 /** 621 * Fires inside the admin-email-confirm-form form tags, before the hidden fields. 622 * 623 * @since 5.3.0 624 */ 625 do_action( 'admin_email_confirm_form' ); 626 627 wp_nonce_field( 'confirm_admin_email', 'confirm_admin_email_nonce' ); 628 629 ?> 630 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 631 632 <h1 class="admin-email__heading"> 633 <?php _e( 'Administration email verification' ); ?> 634 </h1> 635 <p class="admin-email__details"> 636 <?php _e( 'Please verify that the <strong>administration email</strong> for this website is still correct.' ); ?> 637 <?php 638 639 // TO-DO 640 /* translators: URL to help page about primary admin email. */ 641 $admin_email_help_url = __( '' ); 642 643 printf( 644 '<a href="%s" rel="noopener noreferrer">%s</a>', 645 esc_url( $admin_email_help_url ), 646 __( 'Why is this important?' ) 647 ); 648 649 ?> 650 </p> 651 <p class="admin-email__details"> 652 <?php 653 654 printf( 655 __( 'Current administration email: <strong>%s</strong>' ), 656 esc_html( $admin_email ) 657 ); 658 659 ?> 660 </p> 661 <p class="admin-email__details"> 662 <?php _e( 'This email may be different from your personal email address.' ); ?> 663 <?php 664 665 printf( 666 '<a href="%s" rel="noopener noreferrer">%s</a>', 667 esc_url( $admin_email_help_url ), 668 __( 'Learn more.' ) 669 ); 670 671 ?> 672 </p> 673 674 <div class="admin-email__actions"> 675 <div class="admin-email__actions-primary"> 676 <?php 677 678 $change_link = admin_url( 'options-general.php' ); 679 $change_link = add_query_arg( 'highlight', 'confirm_admin_email', $change_link ); 680 681 ?> 682 <a class="button button-large" href="<?php echo esc_url( $change_link ); ?>"><?php _e( 'Update' ); ?></a> 683 <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' ); ?>" /> 684 </div> 685 <div class="admin-email__actions-secondary"> 686 <?php 687 688 $remind_me_link = wp_login_url( $redirect_to ); 689 $remind_me_link = add_query_arg( 690 array( 691 'action' => 'confirm_admin_email', 692 'remind_me_later' => 'true', 693 ), 694 $remind_me_link 695 ); 696 697 ?> 698 <a href="<?php echo esc_url( $remind_me_link ); ?>"><?php _e( 'Remind me later' ) ?></a> 699 </div> 700 </div> 701 </form> 702 703 <?php 704 705 login_footer(); 706 break; 707 514 708 case 'postpass': 515 709 if ( ! array_key_exists( 'post_password', $_POST ) ) { 516 710 wp_safe_redirect( wp_get_referer() ); 517 exit ();711 exit; 518 712 } 519 713 520 714 require_once ABSPATH . WPINC . '/class-phpass.php'; … … 532 726 */ 533 727 $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS ); 534 728 $referer = wp_get_referer(); 729 535 730 if ( $referer ) { 536 731 $secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) ); 537 732 } else { 538 733 $secure = false; 539 734 } 735 540 736 setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); 541 737 542 738 wp_safe_redirect( wp_get_referer() ); … … 553 749 $redirect_to = $_REQUEST['redirect_to']; 554 750 $requested_redirect_to = $redirect_to; 555 751 } else { 556 $redirect_to 752 $redirect_to = add_query_arg( 557 753 array( 558 754 'loggedout' => 'true', 559 755 'wp_lang' => get_user_locale( $user ), … … 560 756 ), 561 757 wp_login_url() 562 758 ); 759 563 760 $requested_redirect_to = ''; 564 761 } 565 762 … … 573 770 * @param WP_User $user The WP_User object for the user that's logging out. 574 771 */ 575 772 $redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user ); 773 576 774 wp_safe_redirect( $redirect_to ); 577 775 exit(); 578 776 … … 580 778 case 'retrievepassword': 581 779 if ( $http_post ) { 582 780 $errors = retrieve_password(); 781 583 782 if ( ! is_wp_error( $errors ) ) { 584 783 $redirect_to = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; 585 784 wp_safe_redirect( $redirect_to ); … … 626 825 627 826 ?> 628 827 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> 828 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> 829 <p> 830 <label for="user_login" ><?php _e( 'Username or Email Address' ); ?><br /> 831 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /></label> 832 </p> 833 <?php 645 834 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' ) ); 835 /** 836 * Fires inside the lostpassword form tags, before the hidden fields. 837 * 838 * @since 2.1.0 839 */ 840 do_action( 'lostpassword_form' ); 651 841 652 echo esc_html( $login_link_separator ); 842 ?> 843 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 844 <p class="submit"> 845 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); ?>" /> 846 </p> 847 </form> 653 848 654 /** This filter is documented in wp-includes/general-template.php */ 655 echo apply_filters( 'register', $registration_url ); 656 endif; 657 ?> 658 </p> 849 <p id="nav"> 850 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 851 <?php 659 852 853 if ( get_option( 'users_can_register' ) ) { 854 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 855 856 echo esc_html( $login_link_separator ); 857 858 /** This filter is documented in wp-includes/general-template.php */ 859 echo apply_filters( 'register', $registration_url ); 860 } 861 862 ?> 863 </p> 660 864 <?php 865 661 866 login_footer( 'user_login' ); 662 663 867 break; 664 868 665 869 case 'resetpass': … … 666 870 case 'rp': 667 871 list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); 668 872 $rp_cookie = 'wp-resetpass-' . COOKIEHASH; 873 669 874 if ( isset( $_GET['key'] ) ) { 670 875 $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) ); 671 876 setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); 877 672 878 wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) ); 673 879 exit; 674 880 } … … 675 881 676 882 if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { 677 883 list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); 678 $user = check_password_reset_key( $rp_key, $rp_login ); 884 885 $user = check_password_reset_key( $rp_key, $rp_login ); 886 679 887 if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) { 680 888 $user = false; 681 889 } … … 685 893 686 894 if ( ! $user || is_wp_error( $user ) ) { 687 895 setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); 896 688 897 if ( $user && $user->get_error_code() === 'expired_key' ) { 689 898 wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); 690 899 } else { 691 900 wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); 692 901 } 902 693 903 exit; 694 904 } 695 905 … … 723 933 login_header( __( 'Reset Password' ), '<p class="message reset-pass">' . __( 'Enter your new password below.' ) . '</p>', $errors ); 724 934 725 935 ?> 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" />936 <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> 937 <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" /> 728 938 729 <div class="user-pass1-wrap">730 <p>731 <label for="pass1"><?php _e( 'New password' ); ?></label>732 </p>939 <div class="user-pass1-wrap"> 940 <p> 941 <label for="pass1"><?php _e( 'New password' ); ?></label> 942 </p> 733 943 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> 944 <div class="wp-pwd"> 945 <div class="password-input-wrapper"> 946 <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" /> 947 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js"> 948 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> 949 </button> 950 </div> 951 <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> 952 </div> 953 <div class="pw-weak"> 954 <label> 955 <input type="checkbox" name="pw_weak" class="pw-checkbox" /> 956 <?php _e( 'Confirm use of weak password' ); ?> 957 </label> 958 </div> 740 959 </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 960 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>961 <p class="user-pass2-wrap"> 962 <label for="pass2"><?php _e( 'Confirm new password' ); ?></label><br /> 963 <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /> 964 </p> 755 965 756 <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>757 <br class="clear" />966 <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p> 967 <br class="clear" /> 758 968 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> 969 <?php 772 970 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' ) ); 971 /** 972 * Fires following the 'Strength indicator' meter in the user password reset form. 973 * 974 * @since 3.9.0 975 * 976 * @param WP_User $user User object of the user whose password is being reset. 977 */ 978 do_action( 'resetpass_form', $user ); 778 979 779 echo esc_html( $login_link_separator ); 980 ?> 981 <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> 982 <p class="submit"> 983 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Reset Password' ); ?>" /> 984 </p> 985 </form> 780 986 781 /** This filter is documented in wp-includes/general-template.php */ 782 echo apply_filters( 'register', $registration_url ); 783 endif; 784 ?> 785 </p> 987 <p id="nav"> 988 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 989 <?php 786 990 991 if ( get_option( 'users_can_register' ) ) { 992 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 993 994 echo esc_html( $login_link_separator ); 995 996 /** This filter is documented in wp-includes/general-template.php */ 997 echo apply_filters( 'register', $registration_url ); 998 } 999 1000 ?> 1001 </p> 787 1002 <?php 1003 788 1004 login_footer( 'user_pass' ); 789 790 1005 break; 791 1006 792 1007 case 'register': … … 820 1035 } 821 1036 822 1037 $errors = register_new_user( $user_login, $user_email ); 1038 823 1039 if ( ! is_wp_error( $errors ) ) { 824 1040 $redirect_to = ! empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; 825 1041 wp_safe_redirect( $redirect_to ); … … 828 1044 } 829 1045 830 1046 $registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; 1047 831 1048 /** 832 1049 * Filters the registration redirect URL. 833 1050 * … … 836 1053 * @param string $registration_redirect The redirect destination URL. 837 1054 */ 838 1055 $redirect_to = apply_filters( 'registration_redirect', $registration_redirect ); 1056 839 1057 login_header( __( 'Registration Form' ), '<p class="message register">' . __( 'Register For This Site' ) . '</p>', $errors ); 1058 840 1059 ?> 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> 1060 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> 1061 <p> 1062 <label for="user_login"><?php _e( 'Username' ); ?><br /> 1063 <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> 1064 </p> 1065 <p> 1066 <label for="user_email"><?php _e( 'Email' ); ?><br /> 1067 <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label> 1068 </p> 1069 <?php 863 1070 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> 1071 /** 1072 * Fires following the 'Email' field in the user registration form. 1073 * 1074 * @since 2.1.0 1075 */ 1076 do_action( 'register_form' ); 869 1077 1078 ?> 1079 <p id="reg_passmail"> 1080 <?php _e( 'Registration confirmation will be emailed to you.' ); ?> 1081 </p> 1082 <br class="clear" /> 1083 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 1084 <p class="submit"> 1085 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" /> 1086 </p> 1087 </form> 1088 1089 <p id="nav"> 1090 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 1091 <?php echo esc_html( $login_link_separator ); ?> 1092 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> 1093 </p> 870 1094 <?php 1095 871 1096 login_footer( 'user_login' ); 872 873 1097 break; 874 1098 875 1099 case 'confirmaction': … … 914 1138 default: 915 1139 $secure_cookie = ''; 916 1140 $customize_login = isset( $_REQUEST['customize-login'] ); 1141 917 1142 if ( $customize_login ) { 918 1143 wp_enqueue_script( 'customize-base' ); 919 1144 } … … 990 1215 $message = '<p class="message">' . __( 'You have logged in successfully.' ) . '</p>'; 991 1216 $interim_login = 'success'; 992 1217 login_header( '', $message ); 1218 993 1219 ?> 994 1220 </div> 995 1221 <?php 1222 996 1223 /** This action is documented in wp-login.php */ 997 1224 do_action( 'login_footer' ); 1225 1226 if ( $customize_login ) { 1227 ?> 1228 <script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script> 1229 <?php 1230 } 1231 998 1232 ?> 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 1233 </body></html> 1003 1234 <?php 1235 1004 1236 exit; 1005 1237 } 1006 1238 1239 // Check if it is time to add a redirect to the admin email confirmation screen. 1240 if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) { 1241 $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); 1242 1243 // If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected 1244 // to the admin email confirmation screen. 1245 /** This filter is documented in wp-login.php */ 1246 $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 180 * DAY_IN_SECONDS ); 1247 1248 if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) { 1249 $redirect_to = add_query_arg( 'action', 'confirm_admin_email', wp_login_url( $redirect_to ) ); 1250 } 1251 } 1252 1007 1253 if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) { 1008 1254 // 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 1255 if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) { … … 1015 1261 } 1016 1262 1017 1263 wp_redirect( $redirect_to ); 1018 exit ();1264 exit; 1019 1265 } 1266 1020 1267 wp_safe_redirect( $redirect_to ); 1021 exit ();1268 exit; 1022 1269 } 1023 1270 1024 1271 $errors = $user; … … 1074 1321 if ( isset( $_POST['log'] ) ) { 1075 1322 $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : ''; 1076 1323 } 1324 1077 1325 $rememberme = ! empty( $_POST['rememberme'] ); 1078 1326 1079 1327 if ( $errors->has_errors() ) { … … 1081 1329 } else { 1082 1330 $aria_describedby_error = ''; 1083 1331 } 1084 ?>1085 1332 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 1333 ?> 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 1334 1118 <?php if ( ! $interim_login ) { ?> 1119 <p id="nav"> 1335 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> 1336 <p> 1337 <label for="user_login"><?php _e( 'Username or Email Address' ); ?><br /> 1338 <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> 1339 </p> 1340 <p> 1341 <label for="user_pass"><?php _e( 'Password' ); ?><br /> 1342 <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input" value="" size="20" /></label> 1343 </p> 1120 1344 <?php 1121 if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : 1122 if ( get_option( 'users_can_register' ) ) : 1345 1346 /** 1347 * Fires following the 'Password' field in the login form. 1348 * 1349 * @since 2.1.0 1350 */ 1351 do_action( 'login_form' ); 1352 1353 ?> 1354 <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> 1355 <p class="submit"> 1356 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); ?>" /> 1357 <?php 1358 1359 if ( $interim_login ) { 1360 ?> 1361 <input type="hidden" name="interim-login" value="1" /> 1362 <?php 1363 } else { 1364 ?> 1365 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 1366 <?php 1367 } 1368 1369 if ( $customize_login ) { 1370 ?> 1371 <input type="hidden" name="customize-login" value="1" /> 1372 <?php 1373 } 1374 1375 ?> 1376 <input type="hidden" name="testcookie" value="1" /> 1377 </p> 1378 </form> 1379 1380 <?php if ( ! $interim_login ) : ?> 1381 <p id="nav"> 1382 <?php 1383 1384 if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) { 1385 if ( get_option( 'users_can_register' ) ) { 1123 1386 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 1124 1387 1125 1388 /** This filter is documented in wp-includes/general-template.php */ … … 1126 1389 echo apply_filters( 'register', $registration_url ); 1127 1390 1128 1391 echo esc_html( $login_link_separator ); 1129 endif; 1392 } 1393 1130 1394 ?> 1131 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> 1132 <?php endif; ?> 1133 </p> 1134 <?php } ?> 1135 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 = ''; 1395 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> 1147 1396 <?php 1148 1397 } 1149 }1150 ?>1151 d.focus();1152 d.select();1153 } catch(e){}1154 }, 200);1155 }1156 1398 1157 <?php 1399 ?> 1400 </p> 1401 <?php endif; // ! $interim_login 1402 1403 $login_script = "function wp_attempt_focus() {"; 1404 $login_script .= "setTimeout( function() {"; 1405 $login_script .= "try {"; 1406 1407 if ( $user_login ) { 1408 $login_script .= "d = document.getElementById( 'user_pass' ); d.value = '';"; 1409 } else { 1410 $login_script .= "d = document.getElementById( 'user_login' );"; 1411 1412 if ( $errors->get_error_code() === 'invalid_username' ) { 1413 $login_script .= "d.value = '';"; 1414 } 1415 } 1416 1417 $login_script .= "d.focus(); d.select();"; 1418 $login_script .= "} catch( er ) {}"; 1419 $login_script .= "}, 200);"; 1420 $login_script .= "}\n"; // End of wp_attempt_focus(). 1421 1158 1422 /** 1159 1423 * Filters whether to print the call to `wp_attempt_focus()` on the login screen. 1160 1424 * … … 1163 1427 * @param bool $print Whether to print the function call. Default true. 1164 1428 */ 1165 1429 if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) { 1430 $login_script .= "wp_attempt_focus();\n"; 1431 } 1432 1433 // Run `wpOnload()` if defined. 1434 $login_script .= "if ( typeof wpOnload === 'function' ) { wpOnload() }"; 1435 1436 ?> 1437 <script type="text/javascript"> 1438 <?php echo $login_script; ?> 1439 </script> 1440 <?php 1441 1442 if ( $interim_login ) { 1166 1443 ?> 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'; 1444 <script type="text/javascript"> 1445 ( function() { 1446 try { 1447 var i, links = document.getElementsByTagName( 'a' ); 1448 for ( i in links ) { 1449 if ( links[i].href ) { 1450 links[i].target = '_blank'; 1451 links[i].rel = 'noreferrer noopener'; 1452 } 1453 } 1454 } catch( er ) {} 1455 }()); 1456 </script> 1457 <?php 1177 1458 } 1178 } catch(e){}1179 }());1180 <?php } ?>1181 </script>1182 1459 1183 <?php1184 1460 login_footer(); 1185 1186 1461 break; 1187 1462 } // End action switch.