Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TYPO3: 404 for restricted access page instead of login form

I have a link pointing to restricted page. When I access the link directly in logout status, its redirect to 404. Actually it should redirect to login form.

I tried:

config {
   typolinkLinkAccessRestrictedPages=PAGE_ID 
   typolinkLinkAccessRestrictedPages_addParams = &return_url=###RETURN_URL###&pageId=###PAGE_ID###
   }

Not working.

Also I tried the login status redirect plugin, no use.

Anyone know how to do this? I am using TYPO3 version 4.4.8.

like image 446
Sivakumar Avatar asked Jul 12 '11 11:07

Sivakumar


3 Answers

As this is still unanswered, does this help? Valid for TYPO3 < 8.x

# Check if user is logged in:
[usergroup = *]
# do something
[else]
page.config >
page.config.additionalHeaders = Location: http://www.yourdomain.org/login.html
[end]

I recently posted this to another questions and it crossed my mind that it might be a suitable workaround for your probem.

Found here

like image 172
Mateng Avatar answered Nov 17 '22 21:11

Mateng


I'm not sure how to make redirection work correctly, but perhaps a bit of background will be helpful.

typolinkLinkAccessRestrictedPages only interacts with link generation. That way, anywhere you have a link to an access restricted page, you should get a link that points to the "PAGE Id" page. I suspect you are using your login pid in place of PAGE Id, which I guess should work, but I haven't used this particular feature. I have typolinkLinkAccessRestrictedPages = NONE which makes all links show up, linked to the correct url, but only users who are logged in will successfully load those pages.

If anyone, without being logged in, uses a bookmark to an access restricted page, or they click on one of these links, or directly type in the address, or whatever, they will run into TYPO3's 404 handling (with the error message: ID was not an accessible page). To change how TYPO3 handles these errors, you need to change what TYPO3 does via this setting in localconf.php:

$TYPO3_CONF_VARS["FE"]["pageNotFound_handling"]

I don't know if there's a clean way to just automatically redirect to the login page without hacking the pageNotFound_handling.

As far as the typoscript solution, that wouldn't work for my site, because the trigger isn't whether or not someone is logged in (often they will not be logged in)--the trigger for my site is trying to access a protected page when you are not logged in. I don't want it to redirect everyone who isn't logged in because a lot of pages don't require any login.

like image 43
cognifloyd Avatar answered Nov 17 '22 22:11

cognifloyd


Fe_login cannot alone do this...

Follow these steps::

  1. Install "pagenotfoundhandling" extention after felogin login configuration.
  2. Configure 403 page as login page in "pagenotfoundhandling" extention configuration.

Then, when you try to access "Access restricted page", "pagenotfoundhandling" will redirect to login page then pagenotfoundhandling handle redirect to again requested page. I have tested this on TYPO3 6.2.14

like image 1
Bharat Parmar Avatar answered Nov 17 '22 20:11

Bharat Parmar