Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RTM] Distinguish between error 401 and 403 #1381

Merged
merged 4 commits into from
Mar 2, 2018
Merged

[RTM] Distinguish between error 401 and 403 #1381

merged 4 commits into from
Mar 2, 2018

Conversation

leofeyer
Copy link
Member

This PR implements #1274.

@leofeyer leofeyer added this to the 4.6.0 milestone Feb 19, 2018
@leofeyer leofeyer self-assigned this Feb 19, 2018
@leofeyer leofeyer changed the title Distinguish between error 401 and 403 [RTM] Distinguish between error 401 and 403 Feb 19, 2018
@@ -79,7 +81,7 @@ public function loginAction(): Response
{
$this->get('contao.framework')->initialize();

if (!isset($GLOBALS['TL_PTY']['error_403']) || !class_exists($GLOBALS['TL_PTY']['error_403'])) {
if (!isset($GLOBALS['TL_PTY']['error_401']) || !class_exists($GLOBALS['TL_PTY']['error_401'])) {
return $this->redirectToRoute('contao_root');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should throw the UnauthorizedHttpException here as well

if ($objPage->protected)
{
if (!\System::getContainer()->get('contao.security.token_checker')->hasFrontendUser())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This service should not be used in this case. It's only meant to check users across firewalls (because it unserialized the token from the session instead of using the token storage).

public static function find401ByPid($intPid, array $arrOptions=array())
{
$t = static::$strTable;
$arrColumns = array("$t.pid=? AND $t.type='error_401'");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this only works if the page is a direct child of the root page? Is this already the case for 403?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

*/
protected function prepare($objRootPage=null)
{
// Use the given root page object if available (thanks to Andreas Schempp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove that 😂

@leofeyer leofeyer merged commit 1894910 into contao:master Mar 2, 2018
leofeyer added a commit that referenced this pull request Feb 27, 2020
Description
-----------

Fixes #1381

Commits
-------

6e591fe1 Correctly calculate the crawler progress (see #1381)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants