Ticket #23279: 23279.diff
File 23279.diff, 20.2 KB (added by , 11 years ago) |
---|
-
new file wp-includes/theme-compat/core/login.php
diff --git wp-includes/theme-compat/core/login.php wp-includes/theme-compat/core/login.php new file mode 100755 index 0000000..b0cd757
- + 1 <?php 2 /** 3 * This file contains the template for the login form. Do not edit this file 4 * directly; instead copy it to your theme and edit there. 5 * 6 * Note that the form input names must not be changed, as this will break the 7 * login form. 8 * 9 * @package WordPress 10 * @subpackage Theme_Compat 11 * @since 3.8 12 */ 13 14 login_header(__('Log In'), '', $errors); 15 ?> 16 17 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> 18 <p> 19 <label for="user_login"><?php _e('Username') ?><br /> 20 <input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label> 21 </p> 22 <p> 23 <label for="user_pass"><?php _e('Password') ?><br /> 24 <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label> 25 </p> 26 <?php 27 /** 28 * Fires following the 'Password' field in the login form. 29 * 30 * @since 2.1.0 31 */ 32 do_action( 'login_form' ); 33 ?> 34 <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p> 35 <p class="submit"> 36 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" /> 37 </p> 38 </form> 39 40 <?php if ( ! $interim_login ) { ?> 41 <p id="nav"> 42 <?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : 43 login_register_link( '', ' | ' ); 44 ?> 45 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a> 46 <?php endif; ?> 47 </p> 48 <?php } ?> 49 50 <script type="text/javascript"> 51 function wp_attempt_focus(){ 52 setTimeout( function(){ 53 try{ 54 <?php if ( $user_login || $interim_login ): ?> 55 d = document.getElementById('user_pass'); 56 d.value = ''; 57 <?php else: ?> 58 d = document.getElementById('user_login'); 59 <?php if ( 'invalid_username' == $errors->get_error_code() ): ?> 60 if( d.value != '' ) 61 d.value = ''; 62 <?php endif; ?> 63 <?php endif; ?> 64 65 d.focus(); 66 d.select(); 67 } catch(e) {} 68 }, 200); 69 } 70 71 <?php if ( !$error ): ?> 72 wp_attempt_focus(); 73 <?php endif; ?> 74 75 if ( typeof wpOnload=='function' ) wpOnload(); 76 77 <?php if ( $interim_login ): ?> 78 (function(){ 79 try { 80 var i, links = document.getElementsByTagName('a'); 81 for ( i in links ) { 82 if ( links[i].href ) 83 links[i].target = '_blank'; 84 } 85 } catch(e){} 86 }()); 87 <?php endif; ?> 88 </script> 89 90 <?php 91 login_footer(); -
new file wp-includes/theme-compat/core/register.php
diff --git wp-includes/theme-compat/core/register.php wp-includes/theme-compat/core/register.php new file mode 100755 index 0000000..83140a5
- + 1 <?php 2 /** 3 * This file contains the template for the registration form. Do not edit this 4 * file directly; instead copy it to your theme and edit there. 5 * 6 * Note that the form input names must not be changed, as this will break the 7 * registration form. 8 * 9 * @package WordPress 10 * @subpackage Theme_Compat 11 * @since 3.8 12 */ 13 14 login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors); 15 ?> 16 17 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post"> 18 <p> 19 <label for="user_login"><?php _e('Username') ?><br /> 20 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label> 21 </p> 22 <p> 23 <label for="user_email"><?php _e('E-mail') ?><br /> 24 <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(wp_unslash($user_email)); ?>" size="25" /></label> 25 </p> 26 <?php 27 /** 28 * Fires following the 'E-mail' field in the user registration form. 29 * 30 * @since 2.1.0 31 */ 32 do_action( 'register_form' ); 33 ?> 34 <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p> 35 <br class="clear" /> 36 <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> 37 </form> 38 39 <p id="nav"> 40 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> | 41 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ) ?>"><?php _e( 'Lost your password?' ); ?></a> 42 </p> 43 44 <?php 45 login_footer('user_login'); -
new file wp-includes/theme-compat/core/resetpassword.php
diff --git wp-includes/theme-compat/core/resetpassword.php wp-includes/theme-compat/core/resetpassword.php new file mode 100755 index 0000000..06efe55
- + 1 <?php 2 /** 3 * This file contains the template for the password reset form. Do not edit this 4 * file directly; instead copy it to your theme and edit there. 5 * 6 * Note that the form input names must not be changed, as this will break the 7 * password reset form. 8 * 9 * @package WordPress 10 * @subpackage Theme_Compat 11 * @since 3.8 12 */ 13 14 login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors ); 15 ?> 16 <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"> 17 18 19 <p> 20 <label for="pass1"><?php _e('New password') ?><br /> 21 <input type="password" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" /></label> 22 </p> 23 <p> 24 <label for="pass2"><?php _e('Confirm new password') ?><br /> 25 <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /></label> 26 </p> 27 28 <div id="pass-strength-result" class="hide-if-no-js"><?php _e('Strength indicator'); ?></div> 29 <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).'); ?></p> 30 31 <?php 32 /** 33 * Fires inside the resetpassword <form> tags. 34 * 35 * @since 2.1.0 36 */ 37 do_action( 'resetpassword_form' ); ?> 38 <br class="clear" /> 39 <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> 40 </form> 41 42 <p id="nav"> 43 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 44 <?php 45 login_register_link( ' | ' ); 46 ?> 47 </p> 48 49 <?php 50 login_footer('user_pass'); -
new file wp-includes/theme-compat/core/retrievepassword.php
diff --git wp-includes/theme-compat/core/retrievepassword.php wp-includes/theme-compat/core/retrievepassword.php new file mode 100755 index 0000000..881d941
- + 1 <?php 2 /** 3 * This file contains the template for the password retrieval form. Do not edit 4 * this file directly; instead copy it to your theme and edit there. 5 * 6 * Note that the form input names must not be changed, as this will break the 7 * password retrieval form. 8 * 9 * @package WordPress 10 * @subpackage Theme_Compat 11 * @since 3.8 12 */ 13 14 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); 15 ?> 16 17 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> 18 <p> 19 <label for="user_login" ><?php _e('Username or E-mail:') ?><br /> 20 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label> 21 </p> 22 <?php 23 /** 24 * Fires inside the lostpassword <form> tags. 25 * 26 * @since 2.1.0 27 */ 28 do_action( 'lostpassword_form' ); ?> 29 <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> 30 </form> 31 32 <p id="nav"> 33 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a> 34 <?php 35 login_register_link( ' | ' ); 36 ?> 37 </p> 38 39 <?php 40 login_footer('user_login'); -
wp-login.php
diff --git wp-login.php wp-login.php index 5db804f..8948308 100644
function retrieve_password() { 390 390 return true; 391 391 } 392 392 393 /** 394 * Locate a login template file 395 * 396 * This uses the child/parent theme's `core/$template.php` template first, 397 * before falling back to the default page in 398 * `wp-includes/theme-compat/core/$template.php` if it doesn't exist. 399 * 400 * @param string $template Template name 401 * @return string Path to the template 402 */ 403 function login_locate_template( $template ) { 404 $template_location = locate_template( 'core/' . $template ); 405 if (empty($template_location)) { 406 $template_location = ABSPATH . WPINC . '/theme-compat/core/' . $template . '.php'; 407 } 408 409 return $template_location; 410 } 411 412 /** 413 * Output a link to the registration form 414 * 415 * This only outputs the link if registration is enabled on the site. 416 * 417 * @param string $before Text to prepend to link (including whitespace) 418 * @param string $after Text to append to link (including whitespace) 419 * @param boolean $echo Should we output this or return it? 420 * @return string|null Link HTML if `$echo` is false 421 */ 422 function login_register_link( $before = '', $after = '', $echo = true ) { 423 if ( ! get_option( 'users_can_register' ) ) 424 return ''; 425 426 $registration_link = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 427 /** 428 * Filter the registration URL below the login form. 429 * 430 * @since 1.5.0 431 * 432 * @param string $registration_link Registration URL. 433 */ 434 $link = $before . apply_filters( 'register', $registration_link ) . $after; 435 436 if ( $echo ) { 437 echo $link; 438 } 439 else { 440 return $link; 441 } 442 } 443 444 function login_output_hidden_fields() { 445 global $action, $redirect_to, $interim_login, $customize_login; 446 447 switch ($action) { 448 case 'resetpass': 449 case 'rp': 450 echo '<input type="hidden" id="user_login" value="' . esc_attr( $_GET['login'] ) . '" autocomplete="off" />'; 451 break; 452 453 case 'lostpassword': 454 case 'retrievepassword': 455 case 'register': 456 echo '<input type="hidden" name="redirect_to" value="' . esc_attr( $redirect_to ) . '" />'; 457 break; 458 459 case 'login': 460 default: 461 if ( $interim_login ) { 462 echo '<input type="hidden" name="interim-login" value="1" />'; 463 } 464 else { 465 echo '<input type="hidden" name="redirect_to" value="' . esc_attr( $redirect_to ) . '" />'; 466 } 467 468 if ( $customize_login ) { 469 echo '<input type="hidden" name="customize-login" value="1" />'; 470 } 471 else { 472 echo '<input type="hidden" name="testcookie" value="1" />'; 473 } 474 break; 475 } 476 } 477 add_action( 'login_form', 'login_output_hidden_fields' ); 478 add_action( 'register_form', 'login_output_hidden_fields' ); 479 add_action( 'lostpassword_form', 'login_output_hidden_fields' ); 480 add_action( 'resetpassword_form', 'login_output_hidden_fields' ); 481 393 482 // 394 483 // Main 395 484 // … … case 'retrievepassword' : 512 601 */ 513 602 do_action( 'lost_password' ); 514 603 515 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);516 517 604 $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : ''; 518 605 519 ?> 520 521 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> 522 <p> 523 <label for="user_login" ><?php _e('Username or E-mail:') ?><br /> 524 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label> 525 </p> 526 <?php 527 /** 528 * Fires inside the lostpassword <form> tags, before the hidden fields. 529 * 530 * @since 2.1.0 531 */ 532 do_action( 'lostpassword_form' ); ?> 533 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> 534 <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> 535 </form> 536 537 <p id="nav"> 538 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a> 539 <?php 540 if ( get_option( 'users_can_register' ) ) : 541 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 542 /** 543 * Filter the registration URL below the login form. 544 * 545 * @since 1.5.0 546 * 547 * @param string $registration_url Registration URL. 548 */ 549 echo ' | ' . apply_filters( 'register', $registration_url ); 550 endif; 551 ?> 552 </p> 553 554 <?php 555 login_footer('user_login'); 606 $template_location = login_locate_template('retrievepassword'); 607 include $template_location; 556 608 break; 557 609 558 610 case 'resetpass' : … … case 'rp' : 592 644 wp_enqueue_script('utils'); 593 645 wp_enqueue_script('user-profile'); 594 646 595 login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors ); 596 597 ?> 598 <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"> 599 <input type="hidden" id="user_login" value="<?php echo esc_attr( $_GET['login'] ); ?>" autocomplete="off" /> 600 601 <p> 602 <label for="pass1"><?php _e('New password') ?><br /> 603 <input type="password" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" /></label> 604 </p> 605 <p> 606 <label for="pass2"><?php _e('Confirm new password') ?><br /> 607 <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /></label> 608 </p> 609 610 <div id="pass-strength-result" class="hide-if-no-js"><?php _e('Strength indicator'); ?></div> 611 <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).'); ?></p> 612 613 <br class="clear" /> 614 <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> 615 </form> 616 617 <p id="nav"> 618 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> 619 <?php 620 if ( get_option( 'users_can_register' ) ) : 621 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 622 /** This filter is documented in wp-login.php */ 623 echo ' | ' . apply_filters( 'register', $registration_url ); 624 endif; 625 ?> 626 </p> 627 628 <?php 629 login_footer('user_pass'); 647 $template_location = login_locate_template('resetpassword'); 648 include $template_location; 630 649 break; 631 650 632 651 case 'register' : … … case 'register' : 670 689 * @param string $registration_redirect The redirect destination URL. 671 690 */ 672 691 $redirect_to = apply_filters( 'registration_redirect', $registration_redirect ); 673 login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);674 ?>675 676 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post">677 <p>678 <label for="user_login"><?php _e('Username') ?><br />679 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label>680 </p>681 <p>682 <label for="user_email"><?php _e('E-mail') ?><br />683 <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(wp_unslash($user_email)); ?>" size="25" /></label>684 </p>685 <?php686 /**687 * Fires following the 'E-mail' field in the user registration form.688 *689 * @since 2.1.0690 */691 do_action( 'register_form' );692 ?>693 <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>694 <br class="clear" />695 <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />696 <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>697 </form>698 692 699 <p id="nav"> 700 <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> | 701 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ) ?>"><?php _e( 'Lost your password?' ); ?></a> 702 </p> 703 704 <?php 705 login_footer('user_login'); 693 $template_location = login_locate_template('register'); 694 include $template_location; 706 695 break; 707 696 708 697 case 'login' : … … default: 825 814 if ( $reauth ) 826 815 wp_clear_auth_cookie(); 827 816 828 login_header(__('Log In'), '', $errors);829 830 817 if ( isset($_POST['log']) ) 831 818 $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : ''; 832 819 $rememberme = ! empty( $_POST['rememberme'] ); 833 ?>834 820 835 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> 836 <p> 837 <label for="user_login"><?php _e('Username') ?><br /> 838 <input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label> 839 </p> 840 <p> 841 <label for="user_pass"><?php _e('Password') ?><br /> 842 <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label> 843 </p> 844 <?php 845 /** 846 * Fires following the 'Password' field in the login form. 847 * 848 * @since 2.1.0 849 */ 850 do_action( 'login_form' ); 851 ?> 852 <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p> 853 <p class="submit"> 854 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" /> 855 <?php if ( $interim_login ) { ?> 856 <input type="hidden" name="interim-login" value="1" /> 857 <?php } else { ?> 858 <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> 859 <?php } ?> 860 <?php if ( $customize_login ) : ?> 861 <input type="hidden" name="customize-login" value="1" /> 862 <?php endif; ?> 863 <input type="hidden" name="testcookie" value="1" /> 864 </p> 865 </form> 866 867 <?php if ( ! $interim_login ) { ?> 868 <p id="nav"> 869 <?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) : 870 if ( get_option( 'users_can_register' ) ) : 871 $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); 872 /** This filter is documented in wp-login.php */ 873 echo apply_filters( 'register', $registration_url ) . ' | '; 874 endif; 875 ?> 876 <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a> 877 <?php endif; ?> 878 </p> 879 <?php } ?> 880 881 <script type="text/javascript"> 882 function wp_attempt_focus(){ 883 setTimeout( function(){ try{ 884 <?php if ( $user_login || $interim_login ) { ?> 885 d = document.getElementById('user_pass'); 886 d.value = ''; 887 <?php } else { ?> 888 d = document.getElementById('user_login'); 889 <?php if ( 'invalid_username' == $errors->get_error_code() ) { ?> 890 if( d.value != '' ) 891 d.value = ''; 892 <?php 893 } 894 }?> 895 d.focus(); 896 d.select(); 897 } catch(e){} 898 }, 200); 899 } 900 901 <?php if ( !$error ) { ?> 902 wp_attempt_focus(); 903 <?php } ?> 904 if(typeof wpOnload=='function')wpOnload(); 905 <?php if ( $interim_login ) { ?> 906 (function(){ 907 try { 908 var i, links = document.getElementsByTagName('a'); 909 for ( i in links ) { 910 if ( links[i].href ) 911 links[i].target = '_blank'; 912 } 913 } catch(e){} 914 }()); 915 <?php } ?> 916 </script> 917 918 <?php 919 login_footer(); 821 $template_location = login_locate_template('login'); 822 include $template_location; 920 823 break; 921 824 } // end action switch