Make WordPress Core


Ignore:
Timestamp:
08/13/2019 05:39:06 PM (4 years ago)
Author:
azaozz
Message:

Admin email verification:

  • Add the admin_email_lifespan option when installing. Fixes a bug where the verification screen is shown right after installation.
  • Reset the same option when upgrading and the user doing the DB upgrade is not an admin. This will ensure the email verification is shown next time an admin logs in.
  • Use site_url() instead of network_site_url() for the form action. The latter seems needed only for password reset.

See #46349.

File:
1 edited

Legend:

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

    r45758 r45788  
    21262126 */
    21272127function upgrade_530() {
    2128     // Do `add_option()` rather than overwriting with `update_option()` as this may run
    2129     // after an admin was redirected to the email verification screen,
    2130     // and the option was updated.
    2131     add_option( 'admin_email_lifespan', 0 );
     2128    // The `admin_email_lifespan` option may have been set by an admin that just logged in,
     2129    // saw the verification screen, clicked on a button there, and is now upgrading the db,
     2130    // or by populate_options() that is called earlier in upgrade_all().
     2131    // In the second case `admin_email_lifespan` should be reset so the verification screen
     2132    // is shown next time an admin logs in.
     2133    if ( function_exists( 'current_user_can' ) && ! current_user_can( 'manage_options' ) ) {
     2134        update_option( 'admin_email_lifespan', 0 );
     2135    }
    21322136}
    21332137
Note: See TracChangeset for help on using the changeset viewer.