Project

General

Profile

Actions

Bug #21830

closed

Redirect with felogin on TYPO3 4.3 does not work

Added by Claus Harup over 14 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Category:
felogin
Target version:
-
Start date:
2009-12-09
Due date:
% Done:

0%

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

Description

Redirect with felogin on TYPO3 4.3 does not work - all I did was to upgrade to 4.3. It worked fine on 4.2.10

(issue imported from #M12990)


Files

0012990v1.patch (588 Bytes) 0012990v1.patch Administrator Admin, 2010-04-11 21:47
12994_trunk.patch (759 Bytes) 12994_trunk.patch Administrator Admin, 2010-05-16 10:11
Actions #1

Updated by Chris topher over 14 years ago

Hi Claus,

there was a fix for redirects recently. This will also be part of TYPO3 4.3.1.
If you want to immediatelly fix this, replacing the file "class.tx_felogin_pi1.php" with the one you can download here should already help:
http://forge.typo3.org/repositories/browse/typo3v4-core/branches/TYPO3_4-3/typo3/sysext/felogin/pi1?rev=6638

Actions #2

Updated by Administrator Admin over 14 years ago

Fix does not work correct

Line 468:
$extraHiddenAr[] = '<input type="hidden" name="referer" value="' . rawurlencode($referer) . '" />';
rawurlencode replace all signs like / with a percent (%) followed by two hex digits.

the following pregmatch on line 583:
if (preg_match('/^http://([[:alnum:]._-]+)//', $url, $match))
checks for normal ascii signs but they dont exist.

=> 404

Actions #3

Updated by Maximilian over 14 years ago

I've the same problem and the patch of the other fix doesn't works, too.

Actions #4

Updated by Maximilian over 14 years ago

The Problem doesn't appear, if you redirect to a site which everybody can see.
Only if you redirect to a site which can only see a loggend in user, 404 appears.

Actions #5

Updated by Bas van der Togt over 14 years ago

The patch does not work. When is this bug gonna fixed?

Actions #6

Updated by Christian Hennecke over 14 years ago

There are still issues with redirection in 4.3.1. If you select to redirect to the referer URL, login will result in a 404 because the referer content is added to the base URL of the site.

Actions #7

Updated by Stefan Geith over 14 years ago

Redirect does NOT work for me, if the page with the felogin-plugin is set to 'Hide at any login'
Redirect DOES work for me, if the page with the felogin-plugin is not access-restricted.

I think this is a bug in felogin -right ?

Actions #8

Updated by Navi about 14 years ago

Yes i'm having same problem on felogin in 4.3.1, when using referer option i get 404, without it, login works.

Actions #9

Updated by Tim Wendisch about 14 years ago

For me it works fine, for non restricted pages.

Actions #10

Updated by Guenter Koch about 14 years ago

Same problem,

and: for over 99%, redirect to a restricted page is desired, i think.

Actions #11

Updated by Frank Buijze about 14 years ago

Problem still exists in 4.3.2

Possible solution:

Insert

case 'login':
if ($this->conf['redirectPageLogin']) {
$redirect_url[] = $this->pi_getPageLink(intval($this->conf['redirectPageLogin']), array(), TRUE);
}

on line 611 of typo3/sysext/felogin/pi1//calss.tx_felogin_pi1.php

Actions #12

Updated by Mark Möller-Bengtsson about 14 years ago

Although this not being the right forum for "Redirect to restricted page-issue" I'll just explain the logic.

Redirecting to a restricted page works perfectly fine.
Your problem is most likely that the redirect occurs after a successful login. In which case, either the login-element or the login-page, has access "Hide at login" thus dissapearing before the redirect is done.

This is a working feature in TYPO3 not a bug in felogin.

Actions #13

Updated by Christian Hennecke about 14 years ago

The problem also exists with pages that have no special access mode set. I'm using shortcuts with "Hide at login" but the actual page that contains the felogin plug-in just has "hide in menu" assigned.

Actions #14

Updated by Guenter Koch about 14 years ago

checking my dependencies, neither the login-element nor the login-page has access "Hide at login", furthermore the problem still exists.

Actions #15

Updated by Administrator Admin about 14 years ago

Is there any security reason, why not to use also rawurldecode like in 0012990v1.patch? It works for me now.

Actions #16

Updated by Vincent Mans about 14 years ago

To make the referer work for me, I changed class tx_felogin_pi1 line 468

from

$extraHiddenAr[] = '<input type="hidden" name="referer" value="' . rawurlencode($referer) . '" />';

into

$extraHiddenAr[] = '<input type="hidden" name="referer" value="' . $referer . '" />';

Guess it's not safe? For now it works.

Actions #17

Updated by Vladimir Kubak about 14 years ago

Not even with method defined by GET/POST variable redirecting doesn't work. After upgrade from 4.2.12 to 4.3.3.

Actions #18

Updated by Vladimir Kubak about 14 years ago

Just found IMHO nonsense on tx_felogin_pi1 line 487:
if (!$gpRedirectUrl && $this->redirectUrl && $this->logintype === 'login')
When making login form, variable $this->logintype is always empty, so redirect variable in login form becomes empty as well.

Actions #19

Updated by Thomas Hirt about 14 years ago

I can cofirn that behavior. I use TYPO3 4.3.3 and changed the class class.tx_felogin_pi1.php to what Christoph mentioned: http://forge.typo3.org/repositories/browse/typo3v4-core/branches/TYPO3_4-3/typo3/sysext/felogin/pi1?rev=6638

Redirect seems not to work at all. This stays empty all the time:
<input type="hidden" name="redirect_url" value="" />

Actions #20

Updated by Administrator Admin almost 14 years ago

I downloaded the latest version of the class tx_felogin_pi1 and replace the code of the line 468 as Vincent Mans says in his commentary, and now it works.

Actions #21

Updated by Andy Hausmann almost 14 years ago

I agree, Vincent Mans' solution works perfectly fine.

I tried to debug the code just minutes ago and came to the same result - after getting the url from the GET-/POST-Vars and right before setting the header via t3lib_utility_Http::redirect() on line 137, the url wasn't rawurldecoded.

If you need the url rawencoded, just replace line 88
$this->referer = t3lib_div::_GP('referer');
with this one:
$this->referer = rawurldecode(t3lib_div::_GP('referer'));

else if you dont need an encoding, just replace line 468
$extraHiddenAr[] = '<input type="hidden" name="referer" value="' . rawurlencode($referer) . '" />';
with this one:
$extraHiddenAr[] = '<input type="hidden" name="referer" value="' . $referer . '" />';

Maybe it is possible to build in the possibility to switch the mode via TypoScript in a further version. Something like:

urlDecode = 1

which adds the encoding and decoding of the url.

Actions #22

Updated by Jigal van Hemert almost 14 years ago

rawurlencode() should be replaced with htmlspecialchars(). Otherwise some URLs may cause validation problems.

Patch attached (the name is incorrect due to a typo, sorry!), patch pending in core list.

Actions #23

Updated by Steffen Kamper almost 14 years ago

committed to trunk rev 7783

Actions #24

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF