Bug #73140
closed
Felogin - redirect needs a right referer
Added by Antoine Bouet almost 9 years ago.
Updated almost 7 years ago.
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 :)
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!
- 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.
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###
}
- Status changed from Needs Feedback to New
- Target version changed from 7.6.3 to Candidate for patchlevel
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?
- Status changed from New to Needs Feedback
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...
- Status changed from Needs Feedback to Closed
Also available in: Atom
PDF