|
|
|
@ -41,6 +41,22 @@ class OpenID_Connect_Generic_Login_Form {
|
|
|
|
|
function handle_login_page( $message ) {
|
|
|
|
|
$settings = $this->settings;
|
|
|
|
|
|
|
|
|
|
// record the URL of this page if set to redirect back to origin page
|
|
|
|
|
if ( $this->settings->redirect_user_back ) {
|
|
|
|
|
$redirect_expiry = time() + DAY_IN_SECONDS;
|
|
|
|
|
if ( $GLOBALS['pagenow'] == 'wp-login.php' ) {
|
|
|
|
|
if ( isset( $_REQUEST['redirect_to'] ) ) {
|
|
|
|
|
$redirect_url = esc_url( $_REQUEST[ 'redirect_to' ] );
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$redirect_url = admin_url();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$redirect_url = home_url( esc_url( add_query_arg( NULL, NULL ) ) );
|
|
|
|
|
}
|
|
|
|
|
setcookie( $this->client_wrapper->cookie_redirect_key, $redirect_url, $redirect_expiry, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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'] );
|
|
|
|
@ -85,20 +101,6 @@ class OpenID_Connect_Generic_Login_Form {
|
|
|
|
|
function make_login_button() {
|
|
|
|
|
$text = apply_filters( 'openid-connect-generic-login-button-text', __( 'Login with OpenID Connect' ) );
|
|
|
|
|
$href = $this->client_wrapper->get_authentication_url();
|
|
|
|
|
|
|
|
|
|
// record the URL of this page if set to redirect back to origin page
|
|
|
|
|
if( $this->settings->redirect_user_back ) {
|
|
|
|
|
$redirect_expiry = time() + DAY_IN_SECONDS;
|
|
|
|
|
if ( $GLOBALS['pagenow'] == 'wp-login.php' ) {
|
|
|
|
|
if( isset( $_REQUEST['redirect_to'] ) )
|
|
|
|
|
$redirect_url = esc_url( $_REQUEST['redirect_to'] );
|
|
|
|
|
else
|
|
|
|
|
$redirect_url = admin_url();
|
|
|
|
|
} else {
|
|
|
|
|
$redirect_url = home_url( esc_url( add_query_arg( NULL, NULL ) ) );
|
|
|
|
|
}
|
|
|
|
|
setcookie( $this->client_wrapper->cookie_redirect_key, $redirect_url, $redirect_expiry, COOKIEPATH, COOKIE_DOMAIN, is_ssl() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ob_start();
|
|
|
|
|
?>
|
|
|
|
|