Make WordPress Core

Changeset 21031 for trunk/wp-login.php


Ignore:
Timestamp:
06/08/2012 07:22:11 PM (14 years ago)
Author:
ryan
Message:

Customizer: Gravefully handle cookie expipration. Prompt for log in in the preview. Props ocean90, koopersmith, nacin. fixes #20876

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-login.php

    r20887 r21031  
    4040 */
    4141function login_header($title = 'Log In', $message = '', $wp_error = '') {
    42     global $error, $interim_login, $current_site;
     42    global $error, $interim_login, $current_site, $customize_login;
    4343
    4444    // Don't index any of these forms
     
    6969    }
    7070
     71    if ( $customize_login )
     72        wp_enqueue_script( 'customize-base' );
     73
    7174    do_action( 'login_enqueue_scripts' );
    7275    do_action( 'login_head' );
     
    8285    $login_header_url   = apply_filters( 'login_headerurl',   $login_header_url   );
    8386    $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 = '#';
    8491
    8592    ?>
     
    127134 */
    128135function login_footer($input_id = '') {
    129     ?>
     136    global $interim_login;
     137
     138    // Don't allow interim logins to navigate away from the page.
     139    if ( ! $interim_login ): ?>
    130140    <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr_e( 'Are you lost?' ); ?>"><?php printf( __( '&larr; Back to %s' ), get_bloginfo( 'title', 'display' ) ); ?></a></p>
     141    <?php endif; ?>
     142
    131143    </div>
    132144
     
    556568    $secure_cookie = '';
    557569    $interim_login = isset($_REQUEST['interim-login']);
     570    $customize_login = isset( $_REQUEST['customize-login'] );
    558571
    559572    // If the user wants ssl but the session is not ssl, force a secure cookie.
     
    592605        if ( $interim_login ) {
    593606            $message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
    594             login_header( '', $message ); ?>
    595             <script type="text/javascript">setTimeout( function(){window.close()}, 8000);</script>
    596             <p class="alignright">
    597             <input type="button" class="button-primary" value="<?php esc_attr_e('Close'); ?>" onclick="window.close()" /></p>
    598             </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>
    599623<?php       exit;
    600624        }
     
    667691        <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
    668692<?php   } ?>
     693<?php   if ( $customize_login ) : ?>
     694        <input type="hidden" name="customize-login" value="1" />
     695<?php   endif; ?>
    669696        <input type="hidden" name="testcookie" value="1" />
    670697    </p>
Note: See TracChangeset for help on using the changeset viewer.