Make WordPress Core

Changeset 29043


Ignore:
Timestamp:
07/09/2014 06:05:00 PM (10 years ago)
Author:
johnbillion
Message:

Persist the "Remember Me" state of the auth cookie when changing your own password. Props jesin. Fixes #27627.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r28903 r29043  
    18891889        if ( isset($plaintext_pass) ) {
    18901890            wp_clear_auth_cookie();
    1891             wp_set_auth_cookie($ID);
     1891
     1892            // Here we calculate the expiration length of the current auth cookie and compare it to the default expiration.
     1893            // If it's greater than this, then we know the user checked 'Remember Me' when they logged in.
     1894            $logged_in_cookie    = wp_parse_auth_cookie( '', 'logged_in' );
     1895            $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $ID, false );
     1896            $remember            = ( ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life );
     1897
     1898            wp_set_auth_cookie( $ID, $remember );
    18921899        }
    18931900    }
Note: See TracChangeset for help on using the changeset viewer.