Skip to content

Commit

Permalink
Add admin email verification screen. Shown every six months after an …
Browse files Browse the repository at this point in the history
…admin has logged in.

Also includes WPCS fixes for wp-login.php.

Props andraganescu, boemedia, lessbloat, azaozz.
See #46349.

git-svn-id: https://develop.svn.wordpress.org/trunk@45757 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
azaozz committed Aug 7, 2019
1 parent bab0d4e commit 296d864
Show file tree
Hide file tree
Showing 5 changed files with 575 additions and 237 deletions.
41 changes: 41 additions & 0 deletions src/wp-admin/css/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ p {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.13);
}

.login-action-confirm_admin_email #login {
width: 60vw;
margin-top: -2vh;
}

@media screen and (max-width: 782px) {
.login-action-confirm_admin_email #login {
width: 100vw;
}
}

.login form .forgetmenot {
font-weight: 400;
float: left;
Expand All @@ -141,6 +152,36 @@ p {
float: right;
}

.login .admin-email-confirm-form .submit {
text-align: center;
}

.admin-email__later {
text-align: left;
}

.login form p.admin-email__details {
margin: 1.1em 0;
}

.login h1.admin-email__heading {
border-bottom: 1px rgb(241, 241, 241) solid;
color: rgb(95, 95, 95);
font-weight: normal;
padding-bottom: 0.5em;
text-align: left;
}

.admin-email__actions div {
padding-top: 1.5em;
}

.login .admin-email__actions .button-primary {
float: none;
margin-left: 0.25em;
margin-right: 0.25em;
}

#login form p {
margin-bottom: 0;
}
Expand Down
17 changes: 17 additions & 0 deletions src/wp-admin/includes/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,10 @@ function upgrade_all() {
upgrade_510();
}

if ( $wp_current_db_version < 45744 ) {
upgrade_530();
}

maybe_disable_link_manager();

maybe_disable_automattic_widgets();
Expand Down Expand Up @@ -2114,6 +2118,19 @@ function upgrade_510() {
delete_site_option( 'upgrade_500_was_gutenberg_active' );
}

/**
* Executes changes made in WordPress 5.3.0.
*
* @ignore
* @since 5.3.0
*/
function upgrade_530() {
// Do `add_option()` rather than overwriting with `update_option()` as this may run
// after an admin was redirected to the email verification screen,
// and the option was updated.
add_option( 'admin_email_lifespan', 0 );
}

/**
* Executes network-level upgrade routines.
*
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/options-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<?php } ?>

<tr>
<th scope="row"><label for="new_admin_email"><?php _e( 'Email Address' ); ?></label></th>
<th scope="row"><label for="new_admin_email"><?php _e( 'Administration Email Address' ); ?></label></th>
<td><input name="new_admin_email" type="email" id="new_admin_email" aria-describedby="new-admin-email-description" value="<?php form_option( 'admin_email' ); ?>" class="regular-text ltr" />
<p class="description" id="new-admin-email-description"><?php _e( 'This address is used for admin purposes. If you change this we will send you an email at your new address to confirm it. <strong>The new address will not become active until confirmed.</strong>' ); ?></p>
<?php
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @global int $wp_db_version
*/
$wp_db_version = 44719;
$wp_db_version = 45744;

/**
* Holds the TinyMCE version
Expand Down
Loading

0 comments on commit 296d864

Please sign in to comment.