Making WordPress.org

Changeset 11628


Ignore:
Timestamp:
03/03/2022 06:54:00 AM (4 years ago)
Author:
dd32
Message:

Plugin Directory: Release confirmation: Expire/cleanup the access token cookie on the template_redirect hook, rather than on can_access() which is called during the pageload.

This previously worked, but with the new WordPress.org header/footer we no longer have a full-page output buffer to handle this for us.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-release-confirmation.php

    r11373 r11628  
    266266                }
    267267
    268                 setcookie( self::COOKIE, false, time() - DAY_IN_SECONDS );
    269 
    270268                return false;
    271269        }
     
    302300                if ( isset( $_REQUEST[ self::URL_PARAM ] ) ) {
    303301                        setcookie( self::COOKIE, $_REQUEST[ self::URL_PARAM ], time() + DAY_IN_SECONDS, '/plugins/', 'wordpress.org', true, true );
     302                }
     303
     304                // Expire the cookie when needed. This is not for security, only performance / cleanliness.
     305                if ( isset( $_COOKIE[ self::COOKIE ] ) && ! self::can_access() ) {
     306                        unset( $_COOKIE[ self::COOKIE ] );
     307                        setcookie( self::COOKIE, false, time() - DAY_IN_SECONDS );
    304308                }
    305309
Note: See TracChangeset for help on using the changeset viewer.