|
|
|
@ -30,10 +30,28 @@ class OpenID_Connect_Generic_Login_Form {
|
|
|
|
|
add_shortcode( 'openid_connect_generic_login_button', array( $login_form, 'make_login_button' ) );
|
|
|
|
|
|
|
|
|
|
$login_form->handle_redirect_cookie();
|
|
|
|
|
$login_form->handle_redirect_login_type_auto();
|
|
|
|
|
|
|
|
|
|
return $login_form;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Auto Login redirect
|
|
|
|
|
*/
|
|
|
|
|
function handle_redirect_login_type_auto()
|
|
|
|
|
{
|
|
|
|
|
if ( $GLOBALS['pagenow'] == 'wp-login.php' && $this->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 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handle login related redirects
|
|
|
|
|
*/
|
|
|
|
@ -67,18 +85,6 @@ class OpenID_Connect_Generic_Login_Form {
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
function handle_login_page( $message ) {
|
|
|
|
|
$settings = $this->settings;
|
|
|
|
|
|
|
|
|
|
// errors and auto login can't happen at the same time
|
|
|
|
|
$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 );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( isset( $_GET['login-error'] ) ) {
|
|
|
|
|
$message .= $this->make_error_output( $_GET['login-error'], $_GET['message'] );
|
|
|
|
|