diff --git a/includes/openid-connect-generic-login-form.php b/includes/openid-connect-generic-login-form.php index fcac98b..fa88e95 100644 --- a/includes/openid-connect-generic-login-form.php +++ b/includes/openid-connect-generic-login-form.php @@ -70,19 +70,22 @@ class OpenID_Connect_Generic_Login_Form { $settings = $this->settings; // errors and auto login can't happen at the same time - if ( isset( $_GET['login-error'] ) ) { - $message = $this->make_error_output( $_GET['login-error'], $_GET['message'] ); - } - else if ( $settings->login_type == 'auto' ) { - wp_redirect( $this->client_wrapper->get_authentication_url() ); - exit; + $message = ''; + if ( $settings->login_type == 'auto' ) { + if ( ! isset( $_GET['login-error'] ) ) { + wp_redirect( $this->client_wrapper->get_authentication_url() ); + exit; + } else { + add_action( 'login_footer', array( $this, 'remove_login_form' ), 99 ); + } } - - // login button is appended to existing messages in case of error - if ( $settings->login_type == 'button' ) { - $message .= $this->make_login_button(); + + if ( isset( $_GET['login-error'] ) ) { + $message .= $this->make_error_output( $_GET['login-error'], $_GET['message'] ); } + // login button is appended to existing messages in case of error + $message .= $this->make_login_button(); return $message; } @@ -122,4 +125,19 @@ class OpenID_Connect_Generic_Login_Form { + +