Skip to content

Commit

Permalink
Fix a login issue on WP-Engine hosting
Browse files Browse the repository at this point in the history
WP-Engine requires additional parameters to exist on the URL for POST requests,
and it applies those using a filter on the site_url hook when using the
login_post scheme. So I've made sure to apply that filter when running in a
WP-Engine environment.
  • Loading branch information
ccoley committed Nov 2, 2018
1 parent 6d14edc commit 5113dac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions class.two-factor-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ public static function login_html( $user, $login_nonce, $redirect_to, $error_msg
$interim_login = isset( $_REQUEST['interim-login'] ); // WPCS: override ok.
$wp_login_url = wp_login_url();

// If we're running in a WP-Engine environment then we need to apply the
// site_url filter with the login_post scheme for the form action.
if (function_exists('is_wpe') && is_wpe()) {
$wp_login_url = apply_filters( 'site_url', $wp_login_url, null, 'login_post', null);
}

$rememberme = 0;
if ( isset( $_REQUEST['rememberme'] ) && $_REQUEST['rememberme'] ) {
$rememberme = 1;
Expand Down

0 comments on commit 5113dac

Please sign in to comment.