diff --git a/public/class-tulo-payway-public.php b/public/class-tulo-payway-public.php index 341ecd4..14500ae 100644 --- a/public/class-tulo-payway-public.php +++ b/public/class-tulo-payway-public.php @@ -80,6 +80,23 @@ public function check_session($wp) global $post; if (is_admin()) return; + + if (strpos($_SERVER["REQUEST_URI"], "favicon") === false) { + if (get_query_var("tpw_session_refresh") == "1") { + $this->common->write_log("!! forced session session refresh using query param"); + $this->session->refresh(); + $currentUrl = home_url( $wp->request ); + $permalinkStructure = get_option( 'permalink_structure' ); + if ($permalinkStructure == "plain") { + $queryVars = $wp->query_vars; + unset($queryVars['tpw_session_refresh']); + $currentUrl = add_query_arg( $queryVars, home_url( $wp->request ) ); + } + $this->common->write_log("!! session has been refreshed, redirecting to: ".$currentUrl); + header("Location: ".$currentUrl, true, 302); + die(); + } + } if ( isset($post->ID) && strpos($_SERVER["REQUEST_URI"], "favicon") === false) { $this->common->write_log("[check_session]"); @@ -94,19 +111,6 @@ public function check_session($wp) $this->common->write_log("session not expired but page is restricted and user is not logged in, needs refresh"); $this->common->write_log($restrictions); $this->session->refresh(); - } else if (get_query_var("tpw_session_refresh") == "1") { - $this->common->write_log("!! forced session session refresh using query param"); - $this->session->refresh(); - $currentUrl = home_url( $wp->request ); - $permalinkStructure = get_option( 'permalink_structure' ); - if ($permalinkStructure == "plain") { - $queryVars = $wp->query_vars; - unset($queryVars['tpw_session_refresh']); - $currentUrl = add_query_arg( $queryVars, home_url( $wp->request ) ); - } - $this->common->write_log("!! session has been refreshed, redirecting to: ".$currentUrl); - header("Location: ".$currentUrl, true, 302); - die(); } } diff --git a/wp-tulo-payway.php b/wp-tulo-payway.php index 187b1e3..be577ef 100644 --- a/wp-tulo-payway.php +++ b/wp-tulo-payway.php @@ -9,13 +9,13 @@ * that starts the plugin. * * @link https://adeprimo.se - * @since 1.0.0 + * @since 1.0.2 * @package Tulo_Payway_Server * * @wordpress-plugin * Plugin Name: Tulo Payway Connector for Wordpress * Description: This plugin integrates with the SSO2 single sign on solution in Tulo Payway. - * Version: 1.0.0 + * Version: 1.0.2 * Author: Adeprimo AB * Author URI: https://adeprimo.se * Text Domain: tulo