Project

General

Profile

Actions

Bug #73140

closed

Felogin - redirect needs a right referer

Added by Antoine Bouet almost 9 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
felogin
Start date:
2016-02-05
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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 :)

Actions #1

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!

Actions #2

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.

Actions #3

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###
}
Actions #4

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
Actions #5

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?

Actions #6

Updated by Jigal van Hemert almost 7 years ago

  • Status changed from New to Needs Feedback
Actions #7

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...

Actions #8

Updated by Wouter Wolters almost 7 years ago

  • Status changed from Needs Feedback to Closed

Closed as requested.

Actions

Also available in: Atom PDF