Make WordPress Core


Ignore:
Timestamp:
06/29/2013 01:31:44 AM (10 years ago)
Author:
azaozz
Message:

Nonce refresh:

  • Update the heartbeat nonce when refreshing nonces on the Edit Post screen.
  • After a user logs in from the auth-check dialog, speed up heatrbeat to check/refresh nonces on the Edit Post screen.
  • Speeding up heartbeat: bring back the setting how long it should last (how many ticks).
  • Add 'heartbeat-nonces-expired' jQuery event when nonces have expired and the user is logged in.

See #23295, see #23216.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ajax-actions.php

    r24520 r24528  
    20552055
    20562056function wp_ajax_heartbeat() {
    2057     check_ajax_referer( 'heartbeat-nonce', '_nonce' );
     2057    if ( empty( $_POST['_nonce'] ) )
     2058        wp_send_json_error();
     2059
    20582060    $response = array();
     2061
     2062    if ( false === wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ) ) {
     2063        // User is logged in but nonces have expired.
     2064        $response['nonces_expired'] = true;
     2065        wp_send_json($response);
     2066    }
    20592067
    20602068    // screen_id is the same as $current_screen->id and the JS global 'pagenow'
     
    20772085    do_action( 'heartbeat_tick', $response, $screen_id );
    20782086
    2079     // send the current time acording to the server
     2087    // Send the current time acording to the server
    20802088    $response['server_time'] = time();
    20812089
Note: See TracChangeset for help on using the changeset viewer.