447 | | if ( ! in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login', 'confirmaction', WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED ), true ) && false === has_filter( 'login_form_' . $action ) ) { |
| 447 | if ( ! in_array( $action, array( 'confirm_admin_email', 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login', 'confirmaction', WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED ), true ) && false === has_filter( 'login_form_' . $action ) ) { |
| 505 | case 'confirm_admin_email': |
| 506 | |
| 507 | if( ! is_user_logged_in() ) { |
| 508 | wp_safe_redirect( wp_login_url( $redirect_to ) ); |
| 509 | } |
| 510 | |
| 511 | if ( ! empty( $_REQUEST['redirect_to'] ) ) { |
| 512 | $redirect_to = $_REQUEST['redirect_to']; |
| 513 | } else { |
| 514 | $redirect_to = admin_url(); |
| 515 | } |
| 516 | |
| 517 | if ( current_user_can( 'manage_options' ) ) { |
| 518 | $admin_email = get_option( 'admin_email' ); |
| 519 | } else { |
| 520 | wp_safe_redirect( $redirect_to ); |
| 521 | } |
| 522 | |
| 523 | $admin_email_max_age = apply_filters( 'admin_email_max_age', 180 * DAY_IN_SECONDS ); |
| 524 | |
| 525 | $admin_email_lifespan = time() + $admin_email_max_age; |
| 526 | $admin_email_remind_in = time() + round ( $admin_email_max_age/4 ); |
| 527 | |
| 528 | if ( ! empty( $_GET[ 'remind_me_later' ] ) ) { |
| 529 | update_option( 'admin_email_lifespan', $admin_email_remind_in ); |
| 530 | wp_safe_redirect( $redirect_to ); |
| 531 | } |
| 532 | |
| 533 | if ( ! empty( $_POST[ 'correct_email' ] ) ) { |
| 534 | update_option( 'admin_email_lifespan', $admin_email_lifespan ); |
| 535 | wp_safe_redirect( $redirect_to ); |
| 536 | } |
| 537 | |
| 538 | /** |
| 539 | * Fires before the admin email confirm form. |
| 540 | * |
| 541 | * @since 5.2.0 |
| 542 | * |
| 543 | * @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid credentials. Note that the error object may not contain any errors. |
| 544 | * |
| 545 | */ |
| 546 | do_action( 'confirm_admin_email' ); |
| 547 | |
| 548 | login_header( __( 'Confirm your admin email' ), '', $errors ); |
| 549 | ?> |
| 550 | |
| 551 | <form class='adminemailconfirmform' name="adminemailconfirmform" id="adminemailconfirmform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=confirm_admin_email', 'login_post' ) ); ?>" method="post"> |
| 552 | |
| 553 | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
| 554 | <?php |
| 555 | /** |
| 556 | * Fires inside the lostpassword form tags, before the hidden fields. |
| 557 | * |
| 558 | * @since 2.1.0 |
| 559 | */ |
| 560 | do_action( 'admin_email_confirm_form' ); |
| 561 | ?> |
| 562 | <h1 class="admin-email__heading"> |
| 563 | <?php |
| 564 | _e( 'Admin email verification' ); |
| 565 | ?> |
| 566 | </h1> |
| 567 | <p class="admin-email__details"> |
| 568 | <?php |
| 569 | _e( 'We\'d like to verify that the <strong>general admin email</strong> for this website is still correct.' ); |
| 570 | ?> |
| 571 | <a href=""> |
| 572 | <?php |
| 573 | _e( 'Why is this important?' ); |
| 574 | ?> |
| 575 | </a> |
| 576 | </p> |
| 577 | <h2 class="admin-email__heading"> |
| 578 | <?php |
| 579 | _e( 'Current general admin email' ); |
| 580 | ?> |
| 581 | </h2> |
| 582 | <p class="admin-email__details"> |
| 583 | <?php _e( 'We have the following email address registered as your <strong>general admin email</strong>:' ); ?> |
| 584 | </p> |
| 585 | |
| 586 | <h2 class="admin-email__heading"> |
| 587 | <?php |
| 588 | echo esc_html( $admin_email ); |
| 589 | ?> |
| 590 | </h2> |
| 591 | <p class="admin-email__details--small"> |
| 592 | <?php _e( 'This can be different from the email address you just logged in with.' ); ?> |
| 593 | <a href=""> |
| 594 | <?php |
| 595 | _e( 'Learn more' ); |
| 596 | ?> |
| 597 | </a> |
| 598 | </p> |
| 599 | |
| 600 | <div class="admin-email__actions"> |
| 601 | <div class="admin-email__actions-primary"> |
| 602 | <?php |
| 603 | |
| 604 | $change_link = admin_url( 'options-general.php?highlight=confirm_admin_email' ); |
| 605 | ?> |
| 606 | <a class="button button-large" href="<?php echo $change_link ?>"> |
| 607 | <?php esc_attr_e( 'Please change' ); ?> |
| 608 | </a> |
| 609 | <input type="submit" name="correct_email" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Yes it\'s correct' ); ?>" /> |
| 610 | </div> |
| 611 | <div class="admin-email__actions-secondary"> |
| 612 | <p class="admin-email__later"> |
| 613 | <?php |
| 614 | |
| 615 | $remind_me_link = wp_login_url( $redirect_to ) . |
| 616 | '&' . 'action=confirm_admin_email' . |
| 617 | '&' . 'remind_me_later=true'; |
| 618 | ?> |
| 619 | <a href="<?php echo $remind_me_link ?>"><?php _e( 'Remind me later' ) ?></a> |
| 620 | </p> |
| 621 | </div> |
| 622 | |
| 623 | </div> |
| 624 | </form> |
| 625 | |
| 626 | <?php |
| 627 | login_footer(); |
| 628 | |
| 629 | break; |
| 630 | |
| 631 | |
| 632 | |