moving auto login redirect to a method that fires during hook init

isekai
Jonathan Daggerhart 8 years ago
parent ef97d0b8b8
commit 0f2d8fc5a8

@ -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'] );

Loading…
Cancel
Save