From ef16b0b3c925c165938044b29abae2ed4289e63d Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Thu, 3 Mar 2022 11:04:11 +0300 Subject: [PATCH 1/2] Issues-681: Redirect issue after login --- .../dashboard/controllers/class.entrycontroller.php | 6 +++++- vanilla/library/core/functions.render.php | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vanilla/applications/dashboard/controllers/class.entrycontroller.php b/vanilla/applications/dashboard/controllers/class.entrycontroller.php index 32da3e8..05bc72a 100644 --- a/vanilla/applications/dashboard/controllers/class.entrycontroller.php +++ b/vanilla/applications/dashboard/controllers/class.entrycontroller.php @@ -375,7 +375,11 @@ protected function checkOverride($type, $target, $transientKey = null) { // FIX: micro-frontends-forums-app issues-12 $isEmbedded = (bool) c('Garden.Embed.Allow',false); $remoteUrl = c("Garden.Embed.RemoteUrl"); - if($isEmbedded && is_string( $remoteUrl)) { + + // FIX Issues-681: signing from Forum + $forceEmbed = $this->Request->get('Source', '') != 'forum'; + + if($isEmbedded && is_string( $remoteUrl) && $forceEmbed) { $targetUrl = rawurlencode($remoteUrl.'/#'.url($target)); } else { $targetUrl = rawurlencode(url($target, true)); diff --git a/vanilla/library/core/functions.render.php b/vanilla/library/core/functions.render.php index 4a7f747..0943f56 100644 --- a/vanilla/library/core/functions.render.php +++ b/vanilla/library/core/functions.render.php @@ -1729,7 +1729,8 @@ function signInUrl($target = '', $force = false) { $target = '' ; } - return '/entry/signin'.($target ? '?Target='.urlencode($target) : ''); + // FIX Issues-681: signing from Forum + return '/entry/signin'.($target ? '?Source=forum&Target='.urlencode($target) : '?Source=forum'); } } From bf3c4907d52abb56a18e79639f831967053db8b8 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 4 Mar 2022 11:23:32 +0300 Subject: [PATCH 2/2] issies-681: using http reffer --- .../dashboard/controllers/class.entrycontroller.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vanilla/applications/dashboard/controllers/class.entrycontroller.php b/vanilla/applications/dashboard/controllers/class.entrycontroller.php index 05bc72a..8a7f565 100644 --- a/vanilla/applications/dashboard/controllers/class.entrycontroller.php +++ b/vanilla/applications/dashboard/controllers/class.entrycontroller.php @@ -377,9 +377,9 @@ protected function checkOverride($type, $target, $transientKey = null) { $remoteUrl = c("Garden.Embed.RemoteUrl"); // FIX Issues-681: signing from Forum - $forceEmbed = $this->Request->get('Source', '') != 'forum'; - - if($isEmbedded && is_string( $remoteUrl) && $forceEmbed) { + //$forceEmbed = $this->Request->get('Source', '') != 'forum'; + $referer = $_SERVER['HTTP_REFERER']; + if($isEmbedded && is_string( $remoteUrl) && $referer != '' && strpos($referer, $remoteUrl) !== false) { $targetUrl = rawurlencode($remoteUrl.'/#'.url($target)); } else { $targetUrl = rawurlencode(url($target, true));