Bug #73140
closedFelogin - redirect needs a right referer
0%
Description
Hi all,
With Felogin, the referer is not valid so the redirection doesn't work.
To make it work, change in /typo3/sysext/felogin/Classes/Controller/FrontendLoginController.php :
line 677 :
$redirect_url[] = preg_replace('/[&?]logintype=[a-z]+/', '', $this->referer);
to
$redirect_url[] = preg_replace('/[&?]logintype=[a-z]+/', '', GeneralUtility::getIndpEnv('HTTP_REFERER'));
Then it works :)
Updated by Christian Brinkert over 8 years ago
I could confirm the issue with referred redirections in different installations.
Your solution works fine for both TYPO3 LTS-branches, tested in TYPO3 6.2.18, 6.2.19 and 7.6.3.
In TYPO3 6.2.18/19 the line to be substituted is 665.
Thanks Antoine for your solution, hope it will be merged in next versions!
Updated by Frans Saris over 8 years ago
- Status changed from New to Needs Feedback
If I'm not mistaken the referer option uses the $_GET[referer] and not HTTP_REFERER.
So if you redirect to a different page to login the referer must be added there.
Updated by Christian Brinkert over 8 years ago
Yes, but the referer won't be added as GET param or as hidden input field, so the $this->referer or $_GET[referer] is at line 677/665 NULL and therefore no redirection will be done.
The required ts configuration, from https://docs.typo3.org/typo3cms/extensions/felogin/Examples/Index.html was already included:
config { typolinkLinkAccessRestrictedPages = PidOfLoginPage typolinkLinkAccessRestrictedPages_addParams = &return_url=###RETURN_URL### }
Updated by Alexander Opitz over 8 years ago
- Status changed from Needs Feedback to New
- Target version changed from 7.6.3 to Candidate for patchlevel
Updated by Jigal van Hemert almost 7 years ago
Christian Brinkert wrote:
Yes, but the referer won't be added as GET param or as hidden input field, so the $this->referer or $_GET[referer] is at line 677/665 NULL and therefore no redirection will be done.
The referrer is added to the extra hidden fields in \TYPO3\CMS\Felogin\Controller\FrontendLoginController::showLogin():
// Check for referer redirect method. if present, save referer in form field if (GeneralUtility::inList($this->conf['redirectMode'], 'referer') || GeneralUtility::inList($this->conf['redirectMode'], 'refererDomains')) { $referer = $this->referer ? $this->referer : GeneralUtility::getIndpEnv('HTTP_REFERER'); if ($referer) { $extraHiddenAr[] = '<input type="hidden" name="referer" value="' . htmlspecialchars($referer) . '" />'; if ($this->piVars['redirectReferrer'] === 'off') { $extraHiddenAr[] = '<input type="hidden" name="' . $this->prefixId . '[redirectReferrer]" value="off" />'; } } }
Can you find the reason why this doesn't seem to happen in your installation?
Updated by Jigal van Hemert almost 7 years ago
- Status changed from New to Needs Feedback
Updated by Christian Brinkert almost 7 years ago
I have no idea in which project the error occurred, but after 2 years it's been a bit too long now - the ticket could be closed for me...
Updated by Wouter Wolters almost 7 years ago
- Status changed from Needs Feedback to Closed
Closed as requested.