From c377e50cfa1f9f9511afed2fad310a64cea6bb2d Mon Sep 17 00:00:00 2001 From: Raif Atef Date: Sun, 20 Nov 2016 00:28:06 +0200 Subject: [PATCH] In case of an error redirect and auto sso, keep the openid connect button and hide the login form. --- .../openid-connect-generic-login-form.php | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) 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 { + +