Changes in trunk/wp-login.php [19414:21031]
- File:
-
- 1 edited
-
trunk/wp-login.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-login.php
r19414 r21031 40 40 */ 41 41 function login_header($title = 'Log In', $message = '', $wp_error = '') { 42 global $error, $i s_iphone, $interim_login, $current_site;42 global $error, $interim_login, $current_site, $customize_login; 43 43 44 44 // Don't index any of these forms … … 55 55 add_action( 'login_head', 'wp_shake_js', 12 ); 56 56 57 ?> 58 <!DOCTYPE html> 59 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 60 <head> 57 ?><!DOCTYPE html> 58 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 59 <head> 61 60 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" /> 62 61 <title><?php bloginfo('name'); ?> › <?php echo $title; ?></title> 63 <?php 62 <?php 63 64 64 wp_admin_css( 'wp-admin', true ); 65 65 wp_admin_css( 'colors-fresh', true ); 66 66 67 if ( $is_iphone ) { ?> 68 <meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" /> 69 <style type="text/css" media="screen"> 70 .login form, .login .message, #login_error { margin-left: 0px; } 71 .login #nav, .login #backtoblog { margin-left: 8px; } 72 .login h1 a { width: auto; } 73 #login { padding: 20px 0; } 74 </style> 75 <?php 76 } 67 if ( wp_is_mobile() ) { ?> 68 <meta name="viewport" content="width=320; initial-scale=0.9; maximum-scale=1.0; user-scalable=0;" /><?php 69 } 70 71 if ( $customize_login ) 72 wp_enqueue_script( 'customize-base' ); 77 73 78 74 do_action( 'login_enqueue_scripts' ); 79 do_action( 'login_head' ); ?> 80 </head> 81 <body class="login"> 82 <?php if ( !is_multisite() ) { ?> 83 <div id="login"><h1><a href="<?php echo esc_url( apply_filters('login_headerurl', 'http://wordpress.org/') ); ?>" title="<?php echo esc_attr( apply_filters('login_headertitle', __( 'Powered by WordPress' ) ) ); ?>"><?php bloginfo('name'); ?></a></h1> 84 <?php } else { ?> 85 <div id="login"><h1><a href="<?php echo esc_url( apply_filters('login_headerurl', network_home_url() ) ); ?>" title="<?php echo esc_attr( apply_filters('login_headertitle', $current_site->site_name ) ); ?>"><span class="hide"><?php bloginfo('name'); ?></span></a></h1> 86 <?php } 75 do_action( 'login_head' ); 76 77 if ( is_multisite() ) { 78 $login_header_url = network_home_url(); 79 $login_header_title = $current_site->site_name; 80 } else { 81 $login_header_url = __( 'http://wordpress.org/' ); 82 $login_header_title = __( 'Powered by WordPress' ); 83 } 84 85 $login_header_url = apply_filters( 'login_headerurl', $login_header_url ); 86 $login_header_title = apply_filters( 'login_headertitle', $login_header_title ); 87 88 // Don't allow interim logins to navigate away from the page. 89 if ( $interim_login ) 90 $login_header_url = '#'; 91 92 ?> 93 </head> 94 <body class="login<?php if ( wp_is_mobile() ) echo ' mobile'; ?>"> 95 <div id="login"> 96 <h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>"><?php bloginfo( 'name' ); ?></a></h1> 97 <?php 98 99 unset( $login_header_url, $login_header_title ); 87 100 88 101 $message = apply_filters('login_message', $message); 89 if ( !empty( $message ) ) echo $message . "\n"; 102 if ( !empty( $message ) ) 103 echo $message . "\n"; 90 104 91 105 // In case a plugin uses $error rather than the $wp_errors object … … 120 134 */ 121 135 function login_footer($input_id = '') { 122 ?> 136 global $interim_login; 137 138 // Don't allow interim logins to navigate away from the page. 139 if ( ! $interim_login ): ?> 123 140 <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr_e( 'Are you lost?' ); ?>"><?php printf( __( '← Back to %s' ), get_bloginfo( 'title', 'display' ) ); ?></a></p> 141 <?php endif; ?> 142 124 143 </div> 125 144 126 <?php if ( !empty($input_id) ) : ?>127 <script type="text/javascript">128 try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}129 if(typeof wpOnload=='function')wpOnload();130 </script>131 <?php endif; ?>132 133 <?php do_action('login_footer'); ?>134 <div class="clear"></div>135 </body>136 </html>137 <?php145 <?php if ( !empty($input_id) ) : ?> 146 <script type="text/javascript"> 147 try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){} 148 if(typeof wpOnload=='function')wpOnload(); 149 </script> 150 <?php endif; ?> 151 152 <?php do_action('login_footer'); ?> 153 <div class="clear"></div> 154 </body> 155 </html> 156 <?php 138 157 } 139 158 140 159 function wp_shake_js() { 141 global $is_iphone; 142 if ( $is_iphone ) 160 if ( wp_is_mobile() ) 143 161 return; 144 162 ?> … … 209 227 } 210 228 $message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n"; 211 $message .= network_ site_url() . "\r\n\r\n";229 $message .= network_home_url( '/' ) . "\r\n\r\n"; 212 230 $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n"; 213 231 $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n"; … … 240 258 * @param string $key Hash to validate sending user's password 241 259 * @param string $login The user login 242 * 243 * @return object|WP_Error 260 * @return object|WP_Error User's database row on success, error object for invalid keys 244 261 */ 245 262 function check_password_reset_key($key, $login) { … … 265 282 * Handles resetting the user's password. 266 283 * 267 * @uses $wpdb WordPress Database object 268 * 269 * @param string $key Hash to validate sending user's password 284 * @param object $user The user 285 * @param string $new_pass New password for the user in plaintext 270 286 */ 271 287 function reset_password($user, $new_pass) { … … 342 358 343 359 // validate action so as to default to the login screen 344 if ( !in_array( $action, array('logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login'), true) && false === has_filter('login_form_' . $action) )360 if ( !in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login' ), true ) && false === has_filter( 'login_form_' . $action ) ) 345 361 $action = 'login'; 346 362 … … 369 385 $http_post = ('POST' == $_SERVER['REQUEST_METHOD']); 370 386 switch ($action) { 387 388 case 'postpass' : 389 if ( empty( $wp_hasher ) ) { 390 require_once( ABSPATH . 'wp-includes/class-phpass.php' ); 391 // By default, use the portable hash from phpass 392 $wp_hasher = new PasswordHash(8, true); 393 } 394 395 // 10 days 396 setcookie( 'wp-postpass_' . COOKIEHASH, $wp_hasher->HashPassword( stripslashes( $_POST['post_password'] ) ), time() + 864000, COOKIEPATH ); 397 398 wp_safe_redirect( wp_get_referer() ); 399 exit(); 400 401 break; 371 402 372 403 case 'logout' : … … 537 568 $secure_cookie = ''; 538 569 $interim_login = isset($_REQUEST['interim-login']); 570 $customize_login = isset( $_REQUEST['customize-login'] ); 539 571 540 572 // If the user wants ssl but the session is not ssl, force a secure cookie. … … 561 593 562 594 // If the user was redirected to a secure login form from a non-secure admin page, and secure login is required but secure admin is not, then don't use a secure 563 // cookie and redirect back to the referring non-secure admin page. This allows logins to always be POSTed over SSL while allowing the user to choose visiting595 // cookie and redirect back to the referring non-secure admin page. This allows logins to always be POSTed over SSL while allowing the user to choose visiting 564 596 // the admin via http or https. 565 597 if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) ) … … 573 605 if ( $interim_login ) { 574 606 $message = '<p class="message">' . __('You have logged in successfully.') . '</p>'; 575 login_header( '', $message ); ?> 576 <script type="text/javascript">setTimeout( function(){window.close()}, 8000);</script> 577 <p class="alignright"> 578 <input type="button" class="button-primary" value="<?php esc_attr_e('Close'); ?>" onclick="window.close()" /></p> 579 </div></body></html> 607 login_header( '', $message ); 608 609 if ( ! $customize_login ) : ?> 610 <script type="text/javascript">setTimeout( function(){window.close()}, 8000);</script> 611 <p class="alignright"> 612 <input type="button" class="button-primary" value="<?php esc_attr_e('Close'); ?>" onclick="window.close()" /></p> 613 <?php endif; 614 615 ?></div><?php 616 617 do_action('login_footer'); 618 619 if ( $customize_login ) : ?> 620 <script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script> 621 <?php endif; ?> 622 </body></html> 580 623 <?php exit; 581 624 } … … 604 647 605 648 // Some parts of this script use the main login form to display a message 606 if ( isset($_GET['loggedout']) && TRUE== $_GET['loggedout'] )649 if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] ) 607 650 $errors->add('loggedout', __('You are now logged out.'), 'message'); 608 651 elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) … … 616 659 elseif ( $interim_login ) 617 660 $errors->add('expired', __('Your session has expired. Please log-in again.'), 'message'); 661 elseif ( strpos( $redirect_to, 'about.php?updated' ) ) 662 $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to experience the awesomeness.' ), 'message' ); 618 663 619 664 // Clear any stale cookies. … … 646 691 <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" /> 647 692 <?php } ?> 693 <?php if ( $customize_login ) : ?> 694 <input type="hidden" name="customize-login" value="1" /> 695 <?php endif; ?> 648 696 <input type="hidden" name="testcookie" value="1" /> 649 697 </p> … … 692 740 break; 693 741 } // end action switch 694 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)