diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-12-06 03:52:10 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2018-12-06 03:52:10 +0300 |
commit | 3db76a6fdab4b1f8ef554bd5e46469301ebeaeef (patch) | |
tree | d9e8856721888eed0ef605ad5aebf30be260be67 /plugins/Login | |
parent | f4f6d39a6dfaa7188768e26a52c60fc1e963747b (diff) |
When you are logged out, the URL gets lost when you log in (#13441)
It won't remember any hash as the hash won't be visible in the referrer etc but it would work for most other pages.
To make it work for hash it would get likely way more complicated like we would need to persist it through JS, temporarily store it somewhere and redirect accordingly. It fixes the case mentioned in the issue.
fix https://github.com/matomo-org/matomo/issues/13328
Diffstat (limited to 'plugins/Login')
-rw-r--r-- | plugins/Login/Controller.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/Login/Controller.php b/plugins/Login/Controller.php index 939a160e96..2db9f15588 100644 --- a/plugins/Login/Controller.php +++ b/plugins/Login/Controller.php @@ -277,6 +277,19 @@ class Controller extends \Piwik\Plugin\Controller $this->passwordResetter->removePasswordResetInfo($login); if (empty($urlToRedirect)) { + $referrer = Url::getReferrer(); + $module = Common::getRequestVar('module', '', 'string'); + // when module is login, we redirect to home... + if ($module !== 'Login' && $module !== Piwik::getLoginPluginName() && $referrer) { + $host = Url::getHostFromUrl($referrer); + // we only redirect to a trusted host + if ($host && Url::isValidHost($host)) { + $urlToRedirect = $referrer; + } + } + } + + if (empty($urlToRedirect)) { $urlToRedirect = Url::getCurrentUrlWithoutQueryString(); } |